cve
large_string
desc
large_string
owner
large_string
repo
large_string
commit_id
large_string
commit_message
large_string
diff
large_string
label
int64
rank
uint32
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
6c014c61237db5aa1d85ccd08416adaa55aed31e
Document more of FFI interface
commit 6c014c61237db5aa1d85ccd08416adaa55aed31e Author: Jack Lloyd <[email protected]> Date: Tue Aug 14 13:21:19 2018 -0400 Document more of FFI interface diff --git a/doc/manual/ffi.rst b/doc/manual/ffi.rst index 97d3e4d23..3061b8ddd 100644 --- a/doc/manual/ffi.rst +++ b/doc/manual/ffi.rst @@ -9,7 +9,102 @@ language's foreign function interface (FFI) libraries. For instance the included Python wrapper uses Python's ``ctypes`` module and the C89 API. This API is of course also useful for programs written directly in C. -Code examples can be found in `src/tests/test_ffi.cpp`. +Code examples can be found in +`the tests <https://github.com/randombit/botan/blob/master/src/tests/test_ffi.cpp>`_. + +Return Codes +--------------- + +Almost all functions in the Botan C interface return an ``int`` error code. The +only exceptions are a handful of functions (like +:cpp:func:`botan_ffi_api_version`) which cannot fail in any circumstances. + +The FFI functions return a non-negative integer (usually 0) to indicate success, +or a negative integer to represent an error. A few functions (like +:cpp:func:`botan_block_cipher_block_size`) return positive integers instead of +zero on success. + +The error codes returned in certain error situations may change over time. This +especially applies to very generic errors like +:cpp:enumerator:`BOTAN_FFI_ERROR_EXCEPTION_THROWN` and +:cpp:enumerator:`BOTAN_FFI_ERROR_UNKNOWN_ERROR`. For instance, before 2.8, setting +an invalid key length resulted in :cpp:enumerator:`BOTAN_FFI_ERROR_EXCEPTION_THROWN` +but now this is specially handled and returns +:cpp:enumerator:`BOTAN_FFI_ERROR_INVALID_KEY_LENGTH` instead. + +The following enum values are defined in the FFI header: + +.. cpp:enumerator:: BOTAN_FFI_SUCCESS = 0 + + Generally returned to indicate success + +.. cpp:enumerator:: BOTAN_FFI_INVALID_VERIFIER = 1 + + Note this value is positive, but still represents an error condition. In + indicates that the function completed successfully, but the value provided + was not correct. For example :cpp:func:`botan_bcrypt_is_valid` returns this + value if the password did not match the hash. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_INVALID_INPUT = -1 + + The input was invalid. (Currently this error return is not used.) + +.. cpp:enumerator:: BOTAN_FFI_ERROR_BAD_MAC = -2 + + While decrypting in an AEAD mode, the tag failed to verify. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE = -10 + + Functions which write a variable amount of space return this if the indicated + buffer length was insufficient to write the data. In that case, the output + length parameter is set to the size that is required. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_EXCEPTION_THROWN = -20 + + An exception was thrown while processing this request, but no further + details are available. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_OUT_OF_MEMORY = -21 + + Memory allocation failed + +.. cpp:enumerator:: BOTAN_FFI_ERROR_BAD_FLAG = -30 + + A value provided in a `flag` variable was unknown. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_NULL_POINTER = -31 + + A null pointer was provided as an argument where that is not allowed. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_BAD_PARAMETER = -32 + + An argument did not match the function. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_KEY_NOT_SET = -33 + + An object that requires a key normally must be keyed before use (eg before + encrypting or MACing data). If this is not done, the operation will fail and + return this error code. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_INVALID_KEY_LENGTH = -34 + + An invalid key length was provided with a call to ``x_set_key``. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_NOT_IMPLEMENTED = -40 + + This is returned if the functionality is not available for some reason. For + example if you call :cpp:func:`botan_hash_init` with a named hash function + which is not enabled, this error is returned. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_INVALID_OBJECT = -50 + + This is used if an object provided did not match the function. For example + calling :cpp:func:`botan_hash_destroy` on a ``botan_rng_t`` object will cause + this return. + +.. cpp:enumerator:: BOTAN_FFI_ERROR_UNKNOWN_ERROR = -100 + + Something bad happened, but we are not sure why or how. Versioning ---------------------------------------- @@ -49,9 +144,16 @@ Versioning Returns the date this version was released as an integer, or 0 if an unreleased version + Utility Functions ---------------------------------------- +.. const char* botan_error_description(int err) + + Return a string representation of the provided error code. If the error code + is unknown, returns the string "Unknown error". The return values are static + constant strings and should not be freed. + .. cpp:function:: int botan_same_mem(const uint8_t* x, const uint8_t* y, size_t len) Returns 0 if `x[0..len] == y[0..len]`, -1 otherwise. @@ -64,6 +166,10 @@ Utility Functions will only contain lower-case letters, upper-case letters otherwise. Returns 0 on success, 1 otherwise. +.. cpp:function:: int botan_hex_decode(const char* hex_str, size_t in_len, uint8_t* out, size_t* out_len) + + Hex decode some data + Random Number Generators ---------------------------------------- @@ -74,7 +180,11 @@ Random Number Generators .. cpp:function:: int botan_rng_init(botan_rng_t* rng, const char* rng_type) Initialize a random number generator object from the given - *rng_type*: "system" or `nullptr`: `System_RNG`, "user": `AutoSeeded_RNG`. + *rng_type*: "system" (or ``nullptr``): ``System_RNG``, + "user": ``AutoSeeded_RNG``, + "user-threadsafe": serialized ``AutoSeeded_RNG``, + "null": ``Null_RNG`` (always fails), + "rdrand": ``RDRAND_RNG`` (if available) .. cpp:function:: int botan_rng_get(botan_rng_t rng, uint8_t* out, size_t out_len) @@ -85,6 +195,18 @@ Random Number Generators Reseeds the random number generator with *bits* number of bits from the `System_RNG`. +.. cpp:function:: int botan_rng_reseed_from_rng(botan_rng_t rng, botan_rng_t src, size_t bits) + + Reseeds the random number generator with *bits* number of bits + taken from the given source RNG. + +.. cpp:function:: int botan_rng_add_entropy(botan_rng_t rng, const uint8_t seed[], size_t len) + + Adds the provided seed material to the internal RNG state. + + This call may be ignored by certain RNG instances (such as RDRAND + or, on some systems, the system RNG). + .. cpp:function:: int botan_rng_destroy(botan_rng_t rng) Destroy the object created by :cpp:func:`botan_rng_init`. @@ -109,6 +231,21 @@ need to implement custom primitives using a PRP. Return the block size of this cipher. +.. cpp:function:: int botan_block_cipher_name(botan_block_cipher_t cipher, \ + char* name, size_t* name_len) + + Return the name of this block cipher algorithm, which may nor may not exactly + match what was passed to :cpp:func:`botan_block_cipher_init`. + +.. cpp:function:: int botan_block_cipher_get_keyspec(botan_block_cipher_t cipher, \ + size_t* out_minimum_keylength, \ + size_t* out_maximum_keylength, \ + size_t* out_keylength_modulo) + + Return the limits on the key which can be provided to this cipher. If any of the + parameters are null, no output is written to that field. This allows retreiving only + (say) the maximum supported keylength, if that is the only information needed. + .. cpp:function:: int botan_block_cipher_clear(botan_block_cipher_t bc) Clear the internal state (such as keys) of this cipher object, but do not deallocate it. @@ -150,6 +287,10 @@ Hash Functions Destroy the object created by :cpp:func:`botan_hash_init`. +.. cpp:function:: int botan_hash_name(botan_hash_t hash, char* name, size_t* name_len) + + Write the name of the hash function to the provided buffer. + .. cpp:function:: int botan_hash_copy_state(botan_hash_t* dest, const botan_hash_t source) Copies the state of the hash object to a new hash object. @@ -210,20 +351,20 @@ Message Authentication Codes Finalize the MAC and place the output in out. Exactly :cpp:func:`botan_mac_output_length` bytes will be written. -Ciphers +Symmetric Ciphers ---------------------------------------- .. cpp:type:: opaque* botan_cipher_t - An opaque data type for a MAC. Don't mess with it, but do remember + An opaque data type for a symmetric cipher object. Don't mess with it, but do remember to set a random key first. And please use an AEAD. .. cpp:function:: botan_cipher_t botan_cipher_init(const char* cipher_name, uint32_t flags) Create a cipher object from a name such as "AES-256/GCM" or "Serpent/OCB". - Flags is a bitfield - The low bit of flags specifies if encrypt or decrypt + Flags is a bitfield; the low bitof ``flags`` specifies if encrypt or decrypt, + ie use 0 for encryption and 1 for decryption. .. cpp:function:: int botan_cipher_destroy(botan_cipher_t cipher) @@ -232,19 +373,42 @@ Ciphers .. cpp:function:: int botan_cipher_set_key(botan_cipher_t cipher, \ const uint8_t* key, size_t key_len) +.. cpp:function:: int botan_cipher_is_authenticated(botan_cipher_t cipher) + +.. cpp:function:: size_t botan_cipher_get_tag_length(botan_cipher_t cipher, size_t* tag_len) + + Write the tag length of the cipher to ``tag_len``. This will be zero for non-authenticted + ciphers. + +.. cpp:function:: int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl) + + Returns 1 if the nonce length is valid, or 0 otherwise. Returns -1 on error (such as + the cipher object being invalid). + +.. cpp:function:: size_t botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t* nl) + + Return the default nonce length + .. cpp:function:: int botan_cipher_set_associated_data(botan_cipher_t cipher, \ const uint8_t* ad, size_t ad_len) + Set associated data. Will fail unless the cipher is an AEAD. + .. cpp:function:: int botan_cipher_start(botan_cipher_t cipher, \ const uint8_t* nonce, size_t nonce_len) -.. cpp:function:: int botan_cipher_is_authenticated(botan_cipher_t cipher) - -.. cpp:function:: size_t botan_cipher_tag_size(botan_cipher_t cipher) + Start processing a message using the provided nonce. -.. cpp:function:: int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl) +.. cpp:function:: int botan_cipher_update(botan_cipher_t cipher, \ + uint32_t flags, \ + uint8_t output[], \ + size_t output_size, \ + size_t* output_written, \ + const uint8_t input_bytes[], \ + size_t input_size, \ + size_t* input_consumed) -.. cpp:function:: size_t botan_cipher_default_nonce_length(botan_cipher_t cipher) + Encrypt or decrypt data. PBKDF ---------------------------------------- @@ -468,9 +632,10 @@ Password Hashing .. cpp:function:: int botan_bcrypt_is_valid(const char* pass, const char* hash) - Check a previously created password hash. - Returns 0 if if this password/hash combination is valid, - 1 if the combination is not valid (but otherwise well formed), + Check a previously created password hash. Returns + :cpp:enumerator:`BOTAN_SUCCESS` if if this password/hash + combination is valid, :cpp:enumerator:`BOTAN_FFI_INVALID_VERIFIER` + if the combination is not valid (but otherwise well formed), negative on error. Public Key Creation, Import and Export @@ -668,13 +833,32 @@ Public Key Encryption/Decryption const char* padding, \ uint32_t flags) + Create a new operation object which can be used to encrypt using the provided + key and the specified padding scheme (such as "OAEP(SHA-256)" for use with + RSA). Flags should be 0 in this version. + .. cpp:function:: int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op) + Destroy the object. + +.. cpp:function:: int botan_pk_op_encrypt_output_length(botan_pk_op_encrypt_t op, \ + size_t ptext_len, size_t* ctext_len) + + Returns an upper bound on the output length if a plaintext of length ``ptext_len`` + is encrypted with this key/parameter setting. This allows correctly sizing the + buffer that is passed to :cpp:func:`botan_pk_op_encrypt`. + .. cpp:function:: int botan_pk_op_encrypt(botan_pk_op_encrypt_t op, \ botan_rng_t rng, \ uint8_t out[], size_t* out_len, \ const uint8_t plaintext[], size_t plaintext_len) + Encrypt the provided data using the key, placing the output in `out`. If + `out` is NULL, writes the length of what the ciphertext would have been to + `*out_len`. However this is computationally expensive (the encryption + actually occurs, then the result is discarded), so it is better to use + :cpp:func:`botan_pk_op_encrypt_output_length` to correctly size the buffer. + .. cpp:type:: opaque* botan_pk_op_decrypt_t An opaque data type for a decryption operation. Don't mess with it. @@ -686,6 +870,13 @@ Public Key Encryption/Decryption .. cpp:function:: int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op) +.. cpp:function:: int botan_pk_op_decrypt_output_length(botan_pk_op_decrypt_t op, \ + size_t ctext_len, size_t* ptext_len) + + For a given ciphertext length, returns the upper bound on the size of the + plaintext that might be enclosed. This allows properly sizing the output + buffer passed to :cpp:func:`botan_pk_op_decrypt`. + .. cpp:function:: int botan_pk_op_decrypt(botan_pk_op_decrypt_t op, \ uint8_t out[], size_t* out_len, \ uint8_t ciphertext[], size_t ciphertext_len) @@ -704,6 +895,10 @@ Signatures .. cpp:function:: int botan_pk_op_sign_destroy(botan_pk_op_sign_t op) +.. cpp:function:: int botan_pk_op_sign_output_length(botan_pk_op_sign_t op, size_t* sig_len) + + Writes the length of the + .. cpp:function:: int botan_pk_op_sign_update(botan_pk_op_sign_t op, \ const uint8_t in[], size_t in_len)
0
64
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c03fbef1ada3e1c87edba7ca725ad3592d185b25
A couple of simple optimizations Weirdly, copy.deepcopy of a set of str is much slower than just creating a new set - maybe because it is also copying the strings? But there is no need for that because while we edit the set we don't edit any members. Saves about 1.5 seconds on Pi2.
commit c03fbef1ada3e1c87edba7ca725ad3592d185b25 Author: Jack Lloyd <[email protected]> Date: Sun Dec 10 11:02:43 2017 -0500 A couple of simple optimizations Weirdly, copy.deepcopy of a set of str is much slower than just creating a new set - maybe because it is also copying the strings? But there is no need for that because while we edit the set we don't edit any members. Saves about 1.5 seconds on Pi2. diff --git a/configure.py b/configure.py index 3a8dc7645..ccc7bfbf0 100755 --- a/configure.py +++ b/configure.py @@ -20,7 +20,6 @@ On Jython target detection does not work (use --os and --cpu). """ import collections -import copy import json import sys import os @@ -1612,17 +1611,25 @@ def yield_objectfile_list(sources, obj_dir, obj_suffix): def generate_build_info(build_paths, modules, cc, arch, osinfo): # pylint: disable=too-many-locals + # first create a map of src_file->owning module + + module_that_owns = {} + + for mod in modules: + for src in mod.sources(): + module_that_owns[src] = mod + def _isa_specific_flags(src): if os.path.basename(src) == 'test_simd.cpp': return cc.get_isa_specific_flags(['simd'], arch) - for mod in modules: - if src in mod.sources(): - isas = mod.need_isa - if 'simd' in mod.dependencies(): - isas.append('simd') + if src in module_that_owns: + module = module_that_owns[src] + isas = module.need_isa + if 'simd' in module.dependencies(): + isas.append('simd') - return cc.get_isa_specific_flags(isas, arch) + return cc.get_isa_specific_flags(isas, arch) if src.startswith('botan_all_'): isas = src.replace('botan_all_', '').replace('.cpp', '').split('_') @@ -2073,7 +2080,7 @@ class ModulesChooser(object): if loaded_modules is None: loaded_modules = set([]) else: - loaded_modules = copy.deepcopy(loaded_modules) + loaded_modules = set(loaded_modules) if module not in available_modules: return False, None @@ -2379,7 +2386,7 @@ class AmalgamationGenerator(object): @staticmethod def strip_header_goop(header_name, header_lines): - lines = copy.deepcopy(header_lines) # defensive copy: don't mutate argument + lines = header_lines start_header_guard_index = None for index, line in enumerate(lines):
0
21
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
02a0f88cd86f68674d8f47ea2315b6a7eafc31f2
Update the release checklist [ci skip]
commit 02a0f88cd86f68674d8f47ea2315b6a7eafc31f2 Author: Jack Lloyd <[email protected]> Date: Sun Oct 27 08:46:45 2024 -0400 Update the release checklist [ci skip] diff --git a/doc/dev_ref/release_process.rst b/doc/dev_ref/release_process.rst index 56e5d736f..5d8143bfa 100644 --- a/doc/dev_ref/release_process.rst +++ b/doc/dev_ref/release_process.rst @@ -15,27 +15,28 @@ starting 8 days before the release (ie the Monday of the week prior). Pre Release Testing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Update relevant third party test suites (eg Limbo and BoGo) and +address any issues. + Do maintainer-mode builds with Clang and GCC to catch any warnings that should be corrected. -Other checks which are not in CI: +Test build configurations using `src/scripts/test_all_configs.py` + +Test a few builds on platforms not in CI (eg OpenBSD, FreeBSD, Solaris) - - Native compile on FreeBSD x86-64 - - Native compile on at least one unusual platform (AIX, NetBSD, ...) - - Build the website content to detect any Doxygen problems - - Test many build configurations (using `src/scripts/test_all_configs.py`) - - Build/test SoftHSM +Confirm that the release notes in ``news.rst`` are accurate and complete. -Confirm that the release notes in ``news.rst`` are accurate and -complete and that the version number in ``version.txt`` is correct. +Check that the version number in ``src/build-data/version.txt`` is correct. Tag the Release ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Update the release date in the release notes and change the entry for -the appropriate branch in ``readme.rst`` to point to the new release. +Update the release date in the release notes. + +Update ``readme.rst`` to point to the new release URL -Now check in, and backport changes to the release branch:: +Check in those changes then backport to the release branch:: $ git commit readme.rst news.rst -m "Update for 3.8.2 release" $ git checkout release-3 @@ -78,7 +79,7 @@ A cron job updates the live site every 10 minutes. Push to GitHub ^^^^^^^^^^^^^^^^^^ -Don't forget to also push tags:: +Push the ``release-3`` and ``master`` branches, including the new tag:: $ git push origin --tags release-3 master @@ -95,9 +96,3 @@ The website is mirrored automatically from a git repository which must be update $ git add . $ git commit -m "Update for 3.8.2" $ git push origin master - -Announce The Release -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Send an email to the botan-announce and botan-devel mailing lists -noting that a new release is available.
0
83
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
f1b1c6e3506fea734bc41cdb7794bf26666d293a
Update news
commit f1b1c6e3506fea734bc41cdb7794bf26666d293a Author: Jack Lloyd <[email protected]> Date: Tue Nov 21 01:36:55 2017 -0500 Update news diff --git a/news.rst b/news.rst index 5bfb02428..ac6fe0fe2 100644 --- a/news.rst +++ b/news.rst @@ -47,6 +47,15 @@ Version 2.4.0, Not Yet Released character. In addition, UCS-4 strings are now supported. (GH #1113 #1250 #1287 #1289) +* In BER decoder, avoid unbounded stack recursion when parsing nested + indefinite length values. Now at most 16 nested indefinite length + values are accepted, anything deeper resulting in a decoding error. + (GH #1304 OSS-Fuzz 4353). + +* A new ASN.1 printer API allows generating a string representation of arbitrary + BER data. This is used in the ``asn1print`` command line utility and may be + useful in other applications, for instance for debugging. + * New functions for bit rotations that distinguish rotating by a compile-time constant vs a runtime variable rotation. This allows better optimizations in both cases. Notably performance of CAST-128
0
6
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
1a9d22bd22653c2eeaed0d8098facacb39c80dc1
Change the default PKCS #8 PBKDF runtime from 200 to 300 milliseconds. Round PBKDF1 and PBKDF2 time-based iterations to multiples of 10000 instead of 8192. Update the password hashing docs a bit.
commit 1a9d22bd22653c2eeaed0d8098facacb39c80dc1 Author: lloyd <[email protected]> Date: Thu Apr 4 14:33:28 2013 +0000 Change the default PKCS #8 PBKDF runtime from 200 to 300 milliseconds. Round PBKDF1 and PBKDF2 time-based iterations to multiples of 10000 instead of 8192. Update the password hashing docs a bit. diff --git a/doc/passhash.rst b/doc/passhash.rst index 8ce3cf805..2b311dc1a 100644 --- a/doc/passhash.rst +++ b/doc/passhash.rst @@ -33,18 +33,23 @@ inspection of the database. There are two solutions to these problems: salting and iteration. Salting refers to including, along with the password, a randomly chosen value which perturbs the one way function. Salting can -reduce the effectivness of offline dictionary generation (because for +reduce the effectivness of offline dictionary generation, because for each potential password, an attacker would have to compute the one way -function output for all possible salts - with a large enough salt, -this can make the problem quite difficult). It also prevents the same +function output for all possible salts. It also prevents the same password from producing the same output, as long as the salts do not -collide. With a large salt (say 80 to 128 bits) this will be quite -unlikely. Iteration refers to the general technique of forcing -multiple one way function evaluations when computing the output, to -slow down the operation. For instance if hashing a single password -requires running SHA-256 100,000 times instead of just once, that will -slow down user authentication by a factor of 100,000, but user -authentication happens quite rarely, and usually there are more +collide. Choosing n-bit salts randomly, salt collisions become likely +only after about 2:sup:`(n/2)` salts have been generated. Choosing a +large salt (say 80 to 128 bits) ensures this is very unlikely. Note +that in password hashing salt collisions are unfortunate, but not +fatal - it simply allows the attacker to attack those two passwords in +parallel easier than they would otherwise be able to. + +The other approach, iteration, refers to the general technique of +forcing multiple one way function evaluations when computing the +output, to slow down the operation. For instance if hashing a single +password requires running SHA-256 100,000 times instead of just once, +that will slow down user authentication by a factor of 100,000, but +user authentication happens quite rarely, and usually there are more expensive operations that need to occur anyway (network and database I/O, etc). On the other hand, an attacker who is attempting to break a database full of stolen password hashes will be seriously @@ -53,6 +58,14 @@ only test at a rate of .0001% of what they would without iterations (or, equivalently, will require 100,000 times as many zombie botnet hosts). +Memory usage while checking a password is also a consideration; if the +computation requires using a certain minimum amount of memory, then an +attacker can become memory-bound, which may in particular make +customized cracking hardware more expensive. Some password hashing +designs, such as scrypt, explicitly attempt to provide this. The +bcrypt approach requires over 4 KiB of RAM (for the Blowfish key +schedule) and may also make some hardware attacks more expensive. + Botan provides two techniques for password hashing, bcrypt and passhash9. @@ -61,10 +74,10 @@ passhash9. Bcrypt Password Hashing ---------------------------------------- -Bcrypt is a password hashing scheme originally designed for use in -OpenBSD, but numerous other implementations exist. It is made -available by including ``bcrypt.h``. Bcrypt provides outputs that -look like this:: +:wikipedia:`Bcrypt` is a password hashing scheme originally designed +for use in OpenBSD, but numerous other implementations exist. +It is made available by including ``bcrypt.h``. Bcrypt provides +outputs that look like this:: "$2a$12$7KIYdyv8Bp32WAvc.7YvI.wvRlyVn0HP/EhPmmOyMQA4YKxINO0p2" @@ -97,19 +110,16 @@ Botan also provides a password hashing technique called passhash9, in "$9$AAAKxwMGNPSdPkOKJS07Xutm3+1Cr3ytmbnkjO6LjHzCMcMQXvcT" .. cpp:function:: std::string generate_passhash9(const std::string& password, \ - RandomNumberGenerator& rng, u16bit work_factor = 10, byte alg_id = 0) + RandomNumberGenerator& rng, u16bit work_factor = 10, byte alg_id = 1) Functions much like ``generate_bcrypt``. The last parameter, ``alg_id``, specifies which PRF to use. Currently defined values - are - - ======= ============== - Value PRF algorithm - ======= ============== - 0 HMAC(SHA-1) - 1 HMAC(SHA-256) - 2 CMAC(Blowfish) - ======= ============== + are 0: HMAC(SHA-1), 1: HMAC(SHA-256), 2: CMAC(Blowfish), + 3: HMAC(SHA-384), 4: HMAC(SHA-512) + + Currently, this performs 10000 * ``work_factor`` PBKDF2 iterations, + using 96 bits of salt taken from ``rng``. The iteration count is + encoded as a 16-bit integer and is multiplied by 10000. .. cpp:function:: bool check_passhash9(const std::string& password, \ const std::string& hash) diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index c758a6a31..e93359141 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -127,7 +127,8 @@ void Blowfish::eks_key_schedule(const byte key[], size_t length, * time being. */ if(workfactor > 18) - throw std::invalid_argument("Requested Bcrypt work factor too large"); + throw std::invalid_argument("Requested Bcrypt work factor " + + std::to_string(workfactor) + " too large"); P.resize(18); std::copy(P_INIT, P_INIT + 18, P.begin()); diff --git a/src/pbkdf/pbkdf1/pbkdf1.cpp b/src/pbkdf/pbkdf1/pbkdf1.cpp index d51cbdc18..9d1672529 100644 --- a/src/pbkdf/pbkdf1/pbkdf1.cpp +++ b/src/pbkdf/pbkdf1/pbkdf1.cpp @@ -34,7 +34,7 @@ PKCS5_PBKDF1::key_derivation(size_t key_len, { if(iterations == 0) { - if(iterations_performed % 8192 == 0) + if(iterations_performed % 10000 == 0) { auto time_taken = std::chrono::high_resolution_clock::now() - start; auto msec_taken = std::chrono::duration_cast<std::chrono::milliseconds>(time_taken); diff --git a/src/pbkdf/pbkdf2/pbkdf2.cpp b/src/pbkdf/pbkdf2/pbkdf2.cpp index c116b10ab..c24bcaff8 100644 --- a/src/pbkdf/pbkdf2/pbkdf2.cpp +++ b/src/pbkdf/pbkdf2/pbkdf2.cpp @@ -81,7 +81,7 @@ PKCS5_PBKDF2::key_derivation(size_t key_len, avoids confusion, and likely some broken implementations break on getting completely randomly distributed values */ - if(iterations % 8192 == 0) + if(iterations % 10000 == 0) { auto time_taken = std::chrono::high_resolution_clock::now() - start; auto usec_taken = std::chrono::duration_cast<std::chrono::microseconds>(time_taken); diff --git a/src/pubkey/pkcs8.h b/src/pubkey/pkcs8.h index 04de723a6..302003ad4 100644 --- a/src/pubkey/pkcs8.h +++ b/src/pubkey/pkcs8.h @@ -57,7 +57,7 @@ BOTAN_DLL std::vector<byte> BER_encode(const Private_Key& key, RandomNumberGenerator& rng, const std::string& pass, - std::chrono::milliseconds msec = std::chrono::milliseconds(200), + std::chrono::milliseconds msec = std::chrono::milliseconds(300), const std::string& pbe_algo = ""); /** @@ -76,7 +76,7 @@ BOTAN_DLL std::string PEM_encode(const Private_Key& key, RandomNumberGenerator& rng, const std::string& pass, - std::chrono::milliseconds msec = std::chrono::milliseconds(200), + std::chrono::milliseconds msec = std::chrono::milliseconds(300), const std::string& pbe_algo = ""); /**
0
40
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
65f5388cff46ff1b80e85b9e5977d08d9bb165e0
Update side channel doc
commit 65f5388cff46ff1b80e85b9e5977d08d9bb165e0 Author: Jack Lloyd <[email protected]> Date: Mon Dec 24 12:25:16 2018 -0500 Update side channel doc diff --git a/doc/manual/side_channels.rst b/doc/manual/side_channels.rst index 32be498e7..8f8067004 100644 --- a/doc/manual/side_channels.rst +++ b/doc/manual/side_channels.rst @@ -9,6 +9,34 @@ obviously all open for future improvement. The following text assumes the reader is already familiar with cryptographic implementations, side channel attacks, and common countermeasures. +Modular Exponentiation +------------------------ + +Modular exponentiation uses a fixed window algorithm with Montgomery +representation. A side channel silent table lookup is used to access the +precomputed powers. The caller provides the maximum possible bit length of the +exponent, and the exponent is zero-padded as required. For example, in a DSA +signature with 256-bit q, the caller will specify a maximum length of exponent +of 256 bits, even if the k that was generated was 250 bits. This avoids leaking +the length of the exponent through the number of loop iterations. +See monty_exp.cpp and monty.cpp + +Karatsuba multiplication algorithm avoids any conditional branches; in +cases where different operations must be performed it instead uses masked +operations. See mp_karat.cpp for details. + +The Montgomery reduction is written to run in constant time. +The final reduction is handled with a masked subtraction. See mp_monty.cpp. + +Barrett Reduction +-------------------- + +The Barrett reduction code is written to avoid input dependent branches. The +Barrett algorithm only works for inputs that are most the square of the modulus; +larger values fall back on a different (slower) division algorithm. This +algorithm is also const time, but the branch allows detecting when a value +larger than the square of the modulus was reduced. + RSA ---------------------- @@ -105,33 +133,6 @@ coming from the length of the RSA key (which is public information). See eme_oaep.cpp. -Modular Exponentiation ------------------------- - -Modular exponentiation uses a fixed window algorithm with Montgomery -representation. A side channel silent table lookup is used to access the -precomputed powers. The caller provides the maximum possible bit length of the -exponent, and the exponent is zero-padded as required. For example, in a DSA -signature with 256-bit q, the caller will specify a maximum length of exponent -of 256 bits, even if the k that was generated was 250 bits. This avoids leaking -the length of the exponent through the number of loop iterations. -See monty_exp.cpp and monty.cpp - -Karatsuba multiplication algorithm avoids any conditional branches; in -cases where different operations must be performed it instead uses masked -operations. See mp_karat.cpp for details. - -The Montgomery reduction is written (and tested) to run in constant time. -The final reduction is handled with a masked subtraction. See mp_monty.cpp. - -Barrett Reduction --------------------- - -The Barrett reduction code is written to avoid input dependent branches. -However the Barrett algorithm only works for inputs that are most the -square of the modulus; larger values fall back to the schoolbook -division algorithm which is not const time. - ECC point decoding ---------------------- @@ -170,9 +171,12 @@ The base point multiplication algorithm is a comb-like technique which precomputes ``P^i,(2*P)^i,(3*P)^i`` for all ``i`` in the range of valid scalars. This means the scalar multiplication involves only point additions and no doublings, which may help against attacks which rely on distinguishing between -point doublings and point additions. The elements of the table are accessed -by masked lookups, so as not to leak information about bits of the scalar -via a cache side channel. +point doublings and point additions. The elements of the table are accessed by +masked lookups, so as not to leak information about bits of the scalar via a +cache side channel. However, whenever 3 sequential bits of the scalar are all 0, +no operation is performed in that iteration of the loop. This exposes the scalar +multiply to a cache-based side channel attack; scalar blinding is necessary to +prevent this attack from leaking information about the scalar. The variable point multiplication algorithm uses a fixed-window algorithm. Since this is normally invoked using untrusted points (eg during ECDH key exchange) it
0
29
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
bb935199499b96f4a544bedc3f5367039e947e81
Add botan_ffi_supports_api function This lets us upgrade the FFI version over time and still allow applications to reliably detect if the current library binary supports their version. As an example, it would be useful to be able to add features to FFI sometime in 2.x. In that case, we would increase the value of the FFI API version, even though anything calling the old API would still work perfectly. Applications can verify at runtime the API they want to use is supported using this new call.
commit bb935199499b96f4a544bedc3f5367039e947e81 Author: Jack Lloyd <[email protected]> Date: Wed Jan 4 13:08:29 2017 -0500 Add botan_ffi_supports_api function This lets us upgrade the FFI version over time and still allow applications to reliably detect if the current library binary supports their version. As an example, it would be useful to be able to add features to FFI sometime in 2.x. In that case, we would increase the value of the FFI API version, even though anything calling the old API would still work perfectly. Applications can verify at runtime the API they want to use is supported using this new call. diff --git a/doc/manual/ffi.rst b/doc/manual/ffi.rst index 7a01dc8ae..b7a0d750f 100644 --- a/doc/manual/ffi.rst +++ b/doc/manual/ffi.rst @@ -14,7 +14,17 @@ Versioning .. cpp:function:: uint32_t botan_ffi_api_version() - Returns the FFI version + Returns the version of the currently supported FFI API. This is + expressed in the form YYYYMMDD of the release date of this version + of the API. + +.. cpp:function int botan_ffi_supports_api(uint32_t version) + + Return 0 iff the FFI version specified is supported by this + library. Otherwise returns -1. The expression + botan_ffi_supports_api(botan_ffi_api_version()) will always + evaluate to 0. A particular version of the library may also support + other (older) versions of the FFI API. .. cpp:function:: const char* botan_version_string() diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp index 4727c0763..5c4cba4e7 100644 --- a/src/lib/ffi/ffi.cpp +++ b/src/lib/ffi/ffi.cpp @@ -208,6 +208,17 @@ uint32_t botan_ffi_api_version() return BOTAN_HAS_FFI; } +int botan_ffi_supports_api(uint32_t api_version) + { + /* + * In the future if multiple versions are supported, this + * function would accept any of them. + */ + if(api_version == BOTAN_HAS_FFI) + return 0; + return -1; + } + const char* botan_version_string() { return Botan::version_cstr(); diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index ed1b55a56..3378e0dcd 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -66,6 +66,12 @@ how to provide the cleanest API for such users would be most welcome. */ BOTAN_DLL uint32_t botan_ffi_api_version(); +/* +* Return 0 (ok) if the version given is one this library supports. +* botan_ffi_supports_api(botan_ffi_api_version()) will always return 0. +*/ +BOTAN_DLL int botan_ffi_supports_api(uint32_t api_version); + BOTAN_DLL const char* botan_version_string(); BOTAN_DLL uint32_t botan_version_major(); BOTAN_DLL uint32_t botan_version_minor(); diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp index dd066e248..243583e8f 100644 --- a/src/tests/test_ffi.cpp +++ b/src/tests/test_ffi.cpp @@ -42,6 +42,7 @@ class FFI_Unit_Tests : public Test result.test_is_eq("Patch version", botan_version_patch(), Botan::version_patch()); result.test_is_eq("Botan version", botan_version_string(), Botan::version_cstr()); result.test_is_eq("Botan version datestamp", botan_version_datestamp(), Botan::version_datestamp()); + result.test_is_eq("FFI supports its own version", botan_ffi_supports_api(botan_ffi_api_version()), 0); const std::vector<uint8_t> mem1 = { 0xFF, 0xAA, 0xFF }; const std::vector<uint8_t> mem2 = mem1;
0
43
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c4da8e6545adb36a4c398fc3f872565e420e4aad
Tweak readme texts [ci skip]
commit c4da8e6545adb36a4c398fc3f872565e420e4aad Author: Jack Lloyd <[email protected]> Date: Sat Nov 5 22:29:27 2016 -0400 Tweak readme texts [ci skip] diff --git a/doc/credits.rst b/doc/credits.rst index ee019070e..cef62f0d4 100644 --- a/doc/credits.rst +++ b/doc/credits.rst @@ -27,7 +27,7 @@ snail-mail address (S), and Bitcoin address (B). D: GF(p) arithmetic N: Olivier de Gaalon - D: SQLite encryption codec (src/wrap/sqlite) + D: SQLite encryption codec (src/contrib/sqlite) N: Matthew Gregan D: Binary file I/O support, allocator fixes @@ -96,7 +96,7 @@ snail-mail address (S), and Bitcoin address (B). N: Vaclav Ovsik E: [email protected] - D: Perl XS module (src/wrap/perl-xs) + D: Perl XS module (src/contrib/perl-xs) N: Luca Piccarreta E: [email protected] diff --git a/news.rst b/news.rst index e59dc6634..bf4ef521e 100644 --- a/news.rst +++ b/news.rst @@ -92,6 +92,11 @@ Version 1.11.34, Not Yet Released will continue not doing anything, until it is eventually removed in a future release. At which point it may indeed cease doing nothing. +* In 1.11.21 the Perl XS wrapper and sqlite encryption codec were + removed to standalone repos. But, it is easier to maintain all + related code inside a single repo so they have returned under + src/contrib. + Version 1.11.33, 2016-10-26 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/readme.rst b/readme.rst index e49a809d9..cc10734ef 100644 --- a/readme.rst +++ b/readme.rst @@ -5,17 +5,21 @@ Botan (Japanese for peony) is a cryptography library written in C++11 and released under the permissive `Simplified BSD <http://botan.randombit.net/license.txt>`_ license. -It contains TLS client and server implementation, X.509 certificates, -ECDSA, AES, GCM, ChaCha20Poly1305, McEliece, bcrypt and other useful -tools. - -As part of the build there is also a `botan` program built for command -line usage (similar to `openssl`). The sources for these are intended to -act as good examples of library usage. +Botan's goal is to be the best option for cryptography in new C++ code by +offering the tools necessary to implement a range of practical systems, such as +TLS/DTLS, PKIX certificate handling, PKCS#11 and TPM hardware support, password +hashing, and post quantum crypto schemes. Find the full feature list below. Development is coordinated on `GitHub <https://github.com/randombit/botan>`_ -and contributions are welcome. Read `doc/contributing.rst` for more -about how to contribute. +and contributions are welcome (read `doc/contributing.rst` for more info). + +If you need help, open a GitHub issue, email the `mailing list +<http://lists.randombit.net/mailman/listinfo/botan-devel/>`_, or try +the botan `gitter.im <https://gitter.im/libbotan/Chat>`_ channel. + +If you think you've found a security bug, read the `security page +<http://botan.randombit.net/security.html>`_ for contact information +and procedures. .. highlight:: none @@ -35,29 +39,8 @@ For all the details on building the library, read the The library can also be built into a single-file amalgamation for easy inclusion into external build systems. -If you need help or have questions, open a ticket on -`GitHub Issues <https://github.com/randombit/botan/issues>`_ or -send a mail to the -`mailing list <http://lists.randombit.net/mailman/listinfo/botan-devel/>`_. - -You can also try the chat room for botan on `gitter.im -<https://gitter.im/libbotan/Chat>`_ where some of the developers hang -out. - -If you think you've found a security bug, read the `security page -<http://botan.randombit.net/security.html>`_ for contact information -and procedures. - In addition to C++, botan has a C89 API specifically designed to be easy -to call from other languages. A Python binding using ctypes is included, -there are also partial bindings for -`Node.js <https://github.com/justinfreitag/node-botan>`_ and -`OCaml <https://github.com/randombit/botan-ocaml>`_ among others. - -There is no support for the SSH protocol in Botan but there is a -separately developed C++11 SSH library by `cdesjardins -<https://github.com/cdesjardins/cppssh>`_ which uses Botan for crypto -operations. +to call from other languages. A Python binding using ctypes is included. Continuous integration status ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -92,11 +75,6 @@ Static analyzer status :target: https://sonarqube.com/dashboard/index/botan :alt: Sonarqube analysis -Code coverage map ---------------------- - -.. image:: https://codecov.io/gh/randombit/botan/graphs/tree.svg - Download ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -117,11 +95,14 @@ source release is recommended. Current Development Work (1.11) ---------------------------------------- -The 1.11 branch is highly recommended, especially for new projects. -Versions 1.11 and later require a working C++11 compiler; GCC 4.8 and -later, Clang 3.5 and later, and MSVC 2013/2015 are regularly tested. +The 1.11 branch is highly recommended, especially for new projects. While still +technically API unstable, the 1.11 branch is very close to an API freeze for +a new stable release branch. + +Versions 1.11 and later require a working C++11 compiler; GCC 4.8 and later, +Clang 3.5 and later, and MSVC 2015 are regularly tested. -The latest development release is +The latest 1.11 release is `1.11.33 <http://botan.randombit.net/releases/Botan-1.11.33.tgz>`_ `(sig) <http://botan.randombit.net/releases/Botan-1.11.33.tgz.asc>`_ released on 2016-10-26 @@ -129,9 +110,10 @@ released on 2016-10-26 Old Stable Series (1.10) ---------------------------------------- -The 1.10 branch is the last version of the library written in C++98 -and is the most commonly packaged version. It is still supported for -security patches, but all development efforts are focused on 1.11. +The 1.10 branch is the last version of the library written in C++98 and is still +the most commonly packaged version. It is no longer supported except for +critical security updates (with all support ending on 2018-1-1), and the +developers do not recommend its use anymore. The latest 1.10 release is `1.10.13 <http://botan.randombit.net/releases/Botan-1.10.13.tgz>`_ @@ -247,3 +229,8 @@ Recommended Algorithms * Key Agreement: ECDH P-256 or Curve25519, with KDF2(SHA-256) If you are concerned about quantum computers, combine ECC with NewHope + +Code coverage map +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://codecov.io/gh/randombit/botan/graphs/tree.svg diff --git a/src/contrib/readme.txt b/src/contrib/readme.txt new file mode 100644 index 000000000..485d364ad --- /dev/null +++ b/src/contrib/readme.txt @@ -0,0 +1,8 @@ + +The code is this directory may be of use to you, but is not written or +maintained by the Botan developers. Patches are welcome. + +- In sqlite, find a patch to enable building a special version of sqlite3 + that encrypts the database + +- In perl-xs, find a wrapper for Perl using XS
0
90
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c4f77168873558a1e73587b9e405afab7282d859
x509 module requires pubkey base module to compile
commit c4f77168873558a1e73587b9e405afab7282d859 Author: lloyd <[email protected]> Date: Wed Oct 1 15:41:23 2008 +0000 x509 module requires pubkey base module to compile diff --git a/src/cert/x509/info.txt b/src/cert/x509/info.txt index 84f6a9a7f..bb297de52 100644 --- a/src/cert/x509/info.txt +++ b/src/cert/x509/info.txt @@ -33,4 +33,5 @@ x509stor.h <requires> asn1 bigint +pubkey </requires>
0
10
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
bb02b60dae96361818ac362d13ac69243d655387
Update news
commit bb02b60dae96361818ac362d13ac69243d655387 Author: Jack Lloyd <[email protected]> Date: Sun Jan 28 17:52:51 2018 -0500 Update news diff --git a/news.rst b/news.rst index 119960028..2022e04e6 100644 --- a/news.rst +++ b/news.rst @@ -4,6 +4,24 @@ Release Notes Version 2.5.0, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* Add support for RSA-PSS signatures in TLS (GH #1285) + +* Add a new Credentials_Manager callback that specifies which CAs the server + has indicated it trusts (GH #1395 fixing #1261) + +* Add new TLS::Callbacks methods that allow creating or removing extensions, + as well as examining extensions sent by the peer (GH #1394 #1186) + +* Make it possible for PKCS10 requests to include custom extensions. This also + makes it possible to use muliple SubjectAlternativeNames of a single type in + a request, which was previously not possible. (GH #1429 #1428) + +* Add DSA and ElGamal keygen functions to FFI (#1426) + +* Add Pipe::prepend_filter to replace Pipe::prepend (GH #1402) + +* Fix a memory leak in the OpenSSL block cipher integration, introduced in 2.2.0 + * Use an improved algorithm for generating safe primes which is several tens of times faster. Also, fix a bug in the prime sieving algorithm which caused standard prime generation (like for RSA keys) to be slower than necessary. @@ -17,6 +35,13 @@ Version 2.5.0, Not Yet Released * Remove use of CPU specific optimization flags, instead the user should set these via CXXFLAGS if desired. (GH #1392) +* The output of ``botan --help`` has been improved (GH #1387) + +* Add ``--der-format`` flag to command line utils, making it possible verify + DSA/ECDSA signatures generated by OpenSSL command line (GH #1409) + +* Add support for ``--library-suffix`` option to ``configure.py`` (GH #1405 #1404) + * Use feature flags to enable/disable system specific code (GH #1378) * The Perl XS based wrapper has been removed, as it was unmaintained and
0
67
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
84c31975154e805c6a2ac75a79b550e5cac9ddb3
Have the release script pull the datestamp from monotone, so it does not need to be manually set before a release.
commit 84c31975154e805c6a2ac75a79b550e5cac9ddb3 Author: lloyd <[email protected]> Date: Wed Jul 25 16:04:02 2012 +0000 Have the release script pull the datestamp from monotone, so it does not need to be manually set before a release. diff --git a/botan_version.py b/botan_version.py index ef75fd5f8..8fb0723db 100644 --- a/botan_version.py +++ b/botan_version.py @@ -1,9 +1,9 @@ release_major = 1 release_minor = 11 -release_patch = 0 - -release_vc_rev = None +release_patch = 1 release_so_abi_rev = 0 -release_datestamp = 20120719 +# These are set by the distribution script +release_vc_rev = None +release_datestamp = 0 diff --git a/doc/release_process.rst b/doc/release_process.rst index 7562ec53f..5419ab468 100644 --- a/doc/release_process.rst +++ b/doc/release_process.rst @@ -10,13 +10,13 @@ Pre Release Checks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Confirm that the release notes under ``doc/relnotes`` are accurate and -complete. Then update the datestamp in the release notes and in -``readme.txt`` and ``botan_version.py`` (also checking that the -version is correct in those files), and change the entry for the -appropriate branch in ``doc/download.rst`` to point to the new -release. Check in these changes (alone, with no other modifications) -with a checkin message along the lines of "Update for X.Y.Z release", -then tag the release with the version in monotone (eg tag '1.11.8', no +complete, updating the datestamp in the release notes and in +``readme.txt``. Additionally confirm the version number in +``botan_version.py`` is correct. Change the entry for the appropriate branch in ``doc/download.rst`` to point to the new release. + +Check in these changes (alone, with no other modifications) with a +checkin message along the lines of "Update for X.Y.Z release", then +tag the release with the version in monotone (eg tag '1.11.8', no prefix). Build The Release @@ -86,5 +86,5 @@ Post Release Process Immediately after the new release is created, update ``botan_version.py`` and ``readme.txt`` once again, incrementing the version number as appropriate and removing the release dates. For -release notes, use "Not Yet Released" as the placeholder. For -``botan_version.py``, use 0. +release notes, use "Not Yet Released" as the placeholder. + diff --git a/src/build-data/scripts/dist.py b/src/build-data/scripts/dist.py index 8a81f17fe..b32edd73f 100755 --- a/src/build-data/scripts/dist.py +++ b/src/build-data/scripts/dist.py @@ -8,14 +8,16 @@ Release script for botan (http://botan.randombit.net/) Distributed under the terms of the Botan license """ -import optparse -import subprocess +import errno import logging +import optparse import os -import sys +import shlex +import StringIO import shutil +import subprocess +import sys import tarfile -import errno def check_subprocess_results(subproc, name): (stdout, stderr) = subproc.communicate() @@ -42,6 +44,45 @@ def run_monotone(db, args): return check_subprocess_results(mtn, 'mtn') +def get_certs(db, rev_id): + tokens = shlex.split(run_monotone(db, ['automate', 'certs', rev_id])) + + def usable_cert(cert): + if 'signature' not in cert or cert['signature'] != 'ok': + return False + if 'trust' not in cert or cert['trust'] != 'trusted': + return False + if 'name' not in cert or 'value' not in cert: + return False + return True + + def cert_builder(tokens): + pairs = zip(tokens[::2], tokens[1::2]) + current_cert = {} + for pair in pairs: + if pair[0] == 'key': + if usable_cert(current_cert): + name = current_cert['name'] + value = current_cert['value'] + current_cert = {} + + logging.debug('Cert %s "%s" for rev %s' % (name, value, rev_id)) + yield (name, value) + + current_cert[pair[0]] = pair[1] + + certs = dict(cert_builder(tokens)) + return certs + +def datestamp(db, rev_id): + certs = get_certs(db, rev_id) + + if 'date' in certs: + return int(certs['date'].replace('-','')[0:8]) + + logging.info('Could not retreive date for %s' % (rev_id)) + return 0 + def gpg_sign(file, keyid): logging.info('Signing %s using PGP id %s' % (file, keyid)) @@ -141,6 +182,8 @@ def main(args = None): for line in contents: if line == 'release_vc_rev = None\n': yield 'release_vc_rev = \'mtn:%s\'\n' % (rev_id) + elif line == 'release_datestamp = 0\n': + yield 'release_vc_rev = %d\n' % (datestamp(rev_iv)) else: yield line
0
56
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
88e0d910dc283018ec5e8c17d1d1fae69fe04207
Readme tweaks [ci skip]
commit 88e0d910dc283018ec5e8c17d1d1fae69fe04207 Author: Jack Lloyd <[email protected]> Date: Mon May 28 09:42:52 2018 -0400 Readme tweaks [ci skip] diff --git a/readme.rst b/readme.rst index e4189dacf..394f06c52 100644 --- a/readme.rst +++ b/readme.rst @@ -5,15 +5,13 @@ Botan (Japanese for peony) is a cryptography library written in C++11 and released under the permissive `Simplified BSD <https://botan.randombit.net/license.txt>`_ license. -Botan's goal is to be the best option for cryptography in new C++ code by -offering the tools necessary to implement a range of practical systems, such as -TLS/DTLS, PKIX certificate handling, PKCS#11 and TPM hardware support, password -hashing, and post quantum crypto schemes. In addition to the C++, botan has a -C89 API specifically designed to be easy to call from other languages. A Python -binding using ctypes is included, and several other -`language bindings <https://github.com/randombit/botan/wiki/Language-Bindings>`_ -are available. - +Botan's goal is to be the best option for cryptography in C++ by offering the +tools necessary to implement a range of practical systems, such as TLS/DTLS, +X.509 certificates, modern AEAD ciphers, PKCS#11 and TPM hardware support, +password hashing, and post quantum crypto schemes. Botan also has a C89 API +specifically designed to be easy to call from other languages. A Python binding +using ctypes is included, and several other `language bindings +<https://github.com/randombit/botan/wiki/Language-Bindings>`_ are available. Find the full feature list below. Development is coordinated on `GitHub <https://github.com/randombit/botan>`_ @@ -114,7 +112,7 @@ Old Release The 1.10 branch is the last version of the library written in C++98. It is no longer supported except for critical security updates (with all support ending -in 2018), and the developers do not recommend its use anymore. +in December 2018), and the developers do not recommend its use anymore. The latest 1.10 release is `1.10.17 <https://botan.randombit.net/releases/Botan-1.10.17.tgz>`_ @@ -133,8 +131,8 @@ Transport Layer Security (TLS) Protocol side only right now), encrypt-then-mac CBC, and extended master secret. * Supports authentication using preshared keys (PSK) or passwords (SRP) * Supports record encryption with ChaCha20Poly1305, AES/OCB, AES/GCM, AES/CCM, - Camellia/GCM, and legacy CBC ciphersuites with AES, Camellia, SEED, or 3DES. -* Key exchange using Diffie-Hellman, ECDH, RSA, or CECPQ1 + Camellia/GCM as well as legacy CBC ciphersuites. +* Key exchange using CECPQ1, ECDH, FFDHE, or RSA Public Key Infrastructure ---------------------------------------- @@ -179,7 +177,7 @@ Other Useful Things * Simple compression API wrapping zlib, bzip2, and lzma libraries * RNG wrappers for system RNG and hardware RNGs * HMAC_DRBG and entropy collection system for userspace RNGs -* PBKDF2 password based key derivation +* Password based key derivation functions PBKDF2 and Scrypt * Password hashing function bcrypt and passhash9 (custom PBKDF scheme) * SRP-6a password authenticated key exchange * Key derivation functions including HKDF, KDF2, SP 800-108, SP 800-56A, SP 800-56C
0
95
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
274dd4d979eb16240a6185ae29cc0b08b56b24c2
Shuffle sections of contributing.rst [ci skip]
commit 274dd4d979eb16240a6185ae29cc0b08b56b24c2 Author: Jack Lloyd <[email protected]> Date: Sat Nov 26 05:24:44 2016 -0500 Shuffle sections of contributing.rst [ci skip] diff --git a/doc/contributing.rst b/doc/contributing.rst index 4ca17e355..5aaf3d61c 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -46,6 +46,83 @@ Library Layout * ``misc`` contains odds and ends: format preserving encryption, SRP, threshold secret sharing, all or nothing transform, and others +Sending patches +======================================== + +All contributions should be submitted as pull requests via GitHub +(https://github.com/randombit/botan). If you are planning a large +change email the mailing list or open a discussion ticket on github +before starting out to make sure you are on the right path. And once +you have something written, free to open a [WIP] PR for early review +and comment. + +If possible please sign your git commits using a PGP key. +See https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work for +instructions on how to set this up. + +Depending on what your change is, your PR should probably also include an update +to ``news.rst`` with a note explaining the change. If your change is a +simple bug fix, a one sentence description is perhaps sufficient. If there is an +existing ticket on GitHub with discussion or other information, reference it in +your change note as 'GH #000'. + +Update ``doc/credits.txt`` with your information so people know what you did! + +If you are interested in contributing but don't know where to start check out +``doc/todo.rst`` for some ideas - these are changes we would almost certainly +accept once they've passed code review. + +Also, try building and testing it on whatever hardware you have handy, +especially non-x86 platforms, or especially C++11 compilers other than the +regularly tested GCC, Clang, and Visual Studio compilers. + +Git Usage +======================================== + +Do *NOT* merge ``master`` into your topic branch, this creates +needless commits and noise in history. Instead, as needed, rebase your +branch against master (``git rebase -i master``) and force push the +branch to update the PR. If the GitHub PR page does not report any +merge conflicts and nobody asks you to rebase, you don't need to +rebase. + +Try to keep your history clean and use rebase to squash your commits +as needed. If your diff is less than roughly 100 lines, it should +probably be a single commit. Only split commits as needed to help with +review/understanding of the change. + +Python +======================================== + +Scripts should be in Python whenever possible. + +For configure.py (and install.py) the target is stock (no modules outside the +standard library) CPython 2.7 plus latest CPython 3.x. Support for CPython 2.6, +PyPy, etc is great when viable (in the sense of not causing problems for 2.7 or +3.x, and not requiring huge blocks of version dependent code). As running this +program succesfully is required for a working build making it as portable as +possible is considered key. + +The python wrapper botan.py targets CPython 2.7, 3.x, and latest PyPy. Note that +a single file is used to avoid dealing with any of Python's various crazy module +distribution issues. + +For random scripts not typically run by an end-user (codegen, visualization, and +so on) there isn't any need to worry about 2.6 and even just running under +Python2 xor Python3 is acceptable if needed. Here it's fine to depend on any +useful modules such as graphviz or matplotlib, regardless if it is available +from a stock CPython install. + +Build Tools and Hints +======================================== + +If you don't already use it for all your C/C++ development, install +``ccache`` now and configure a large cache on a fast disk. It allows for +very quick rebuilds by caching the compiler output. + +Use ``--with-sanitizers`` to enable ASan. UBSan has to be added separately +with ``--cc-abi-flags`` at the moment as GCC 4.8 does not have UBSan. + Copyright Notice ======================================== @@ -108,52 +185,7 @@ use ``std::bind``. Use ``::`` to explicitly refer to the global namespace (eg, when calling an OS or library function like ``::select`` or ``::sqlite3_open``). -Sending patches -======================================== - -All contributions should be submitted as pull requests via GitHub -(https://github.com/randombit/botan). If you are planning a large -change email the mailing list or open a discussion ticket on github -before starting out to make sure you are on the right path. And once -you have something written, free to open a [WIP] PR for early review -and comment. - -If possible please sign your git commits using a PGP key. -See https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work for -instructions on how to set this up. - -Depending on what your change is, your PR should probably also include an update -to ``news.rst`` with a note explaining the change. If your change is a -simple bug fix, a one sentence description is perhaps sufficient. If there is an -existing ticket on GitHub with discussion or other information, reference it in -your change note as 'GH #000'. - -Update ``doc/credits.txt`` with your information so people know what you did! - -If you are interested in contributing but don't know where to start check out -``doc/todo.rst`` for some ideas - these are changes we would almost certainly -accept once they've passed code review. - -Also, try building and testing it on whatever hardware you have handy, -especially non-x86 platforms, or especially C++11 compilers other than the -regularly tested GCC, Clang, and Visual Studio compilers. - -Git Usage -======================================== - -Do *NOT* merge ``master`` into your topic branch, this creates -needless commits and noise in history. Instead, as needed, rebase your -branch against master (``git rebase -i master``) and force push the -branch to update the PR. If the GitHub PR page does not report any -merge conflicts and nobody asks you to rebase, you don't need to -rebase. - -Try to keep your history clean and use rebase to squash your commits -as needed. If your diff is less than roughly 100 lines, it should -probably be a single commit. Only split commits as needed to help with -review/understanding of the change. - -External Dependencies +Use of External Dependencies ======================================== Compiler Dependencies @@ -223,45 +255,3 @@ algorithms), potentially a parallelism framework such as Cilk (as part of a larger design for parallel message processing, say), or hypothentically use of a safe ASN.1 parser (that is, one written in a safe language like Rust or OCaml providing a C API). - -Test Tools -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Integration to better leverage specialized test or verification tools such as -valgrind, ASan/UBSan, AFL, LLVM libFuzzer, KLEE, Coq, etc is fine. Typically -these are not enabled or used during normal builds but are specially set up by -developers or auditors. - -The fuzzer tests currently live at https://github.com/randombit/botan-fuzzers - -Python -======================================== - -Scripts should be in Python whenever possible. - -For configure.py (and install.py) the target is stock (no modules outside the -standard library) CPython 2.7 plus latest CPython 3.x. Support for CPython 2.6, -PyPy, etc is great when viable (in the sense of not causing problems for 2.7 or -3.x, and not requiring huge blocks of version dependent code). As running this -program succesfully is required for a working build making it as portable as -possible is considered key. - -The python wrapper botan.py targets CPython 2.7, 3.x, and latest PyPy. Note that -a single file is used to avoid dealing with any of Python's various crazy module -distribution issues. - -For random scripts not typically run by an end-user (codegen, visualization, and -so on) there isn't any need to worry about 2.6 and even just running under -Python2 xor Python3 is acceptable if needed. Here it's fine to depend on any -useful modules such as graphviz or matplotlib, regardless if it is available -from a stock CPython install. - -Build Tools and Hints -======================================== - -If you don't already use it for all your C/C++ development, install -``ccache`` now and configure a large cache on a fast disk. It allows for -very quick rebuilds by caching the compiler output. - -Use ``--with-sanitizers`` to enable ASan. UBSan has to be added separately -with ``--cc-abi-flags`` at the moment as GCC 4.8 does not have UBSan.
0
73
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
b73ecdcb0ad7199e95b4a06eb029edb49eef6a47
Merge GH #437 add X509_Certificate::v3_extensions Makes it possible for an application to interpret some extension not supported by the library.
commit b73ecdcb0ad7199e95b4a06eb029edb49eef6a47 Merge: 27c9aeb85 6ab73e037 Author: Jack Lloyd <[email protected]> Date: Sun Mar 6 05:55:23 2016 -0500 Merge GH #437 add X509_Certificate::v3_extensions Makes it possible for an application to interpret some extension not supported by the library. diff --cc src/lib/cert/x509/x509_ext.h index 0614b9a52,28fdbd57a..8d2dcb52b --- a/src/lib/cert/x509/x509_ext.h +++ b/src/lib/cert/x509/x509_ext.h @@@ -70,8 -72,7 +72,9 @@@ class BOTAN_DLL Extensions : public ASN Extensions& operator=(const Extensions&); Extensions(const Extensions&); - Extensions(bool st = true) : m_throw_on_unknown_critical(st) {} ++ + explicit Extensions(bool st = true) : m_throw_on_unknown_critical(st) {} - ~Extensions(); ++ private: static Certificate_Extension* get_extension(const OID&);
0
1
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
2218df2b15a326368a032b757b047d9937201015
Update news [ci skip]
commit 2218df2b15a326368a032b757b047d9937201015 Author: Jack Lloyd <[email protected]> Date: Thu Apr 15 06:40:11 2021 -0400 Update news [ci skip] diff --git a/news.rst b/news.rst index 5a7cefa19..8f40f41e7 100644 --- a/news.rst +++ b/news.rst @@ -30,6 +30,11 @@ Version 3.0.0, Not Yet Released * Remove use of ``shared_ptr`` from certificate store API as since 2.4.0 ``X509_Certificate`` is internally a ``shared_ptr``. (GH #2484) +* Add new interface ``T::new_object`` which supplants ``T::clone``. The + difference is that ``new_object`` returns a ``unique_ptr<T>`` instead of a raw + pointer ``T*``. ``T::clone`` is retained but simply releases the result of + ``new_object``. (GH #2689 #2704) + * Use smaller tables in the implementations of Camellia, ARIA, SEED, DES, and Whirlpool (GH #2534 #2558) @@ -46,6 +51,9 @@ Version 3.0.0, Not Yet Released * Change how DL exponents are sized; now exponents are slightly larger and are always chosen to be 8-bit aligned. (GH #2545) +* Add an API to ``PasswordHash`` accepting an AD and/or secret key, allowing + those facilities to be used without using an algorithm specific API (GH #2707) + * Add new ``X509_DN::DER_encode`` function. (GH #2472) * Add support for keyed BLAKE2b (GH #2524) @@ -55,9 +63,21 @@ Version 3.0.0, Not Yet Released * Several enums including ``DL_Group::Format``, ``EC_Group_Formatting``, ``CRL_Code``, and ``ASN1_Tag`` are now ``enum class``. (GH #2551 #2552) +* ``ASN1_Tag`` enum has been split into ``ASN1_Type`` and ``ASN1_Class``. + (GH #2584) + * Re-enable support for CLMUL instruction on Visual C++, which was accidentally disabled starting in 2.12.0 +* Avoid using or returning raw pointers whenever possible. (GH #2683 #2684 + #2685 #2687 #2688 #2690 #2691 #2693 #2694 #2695 #2696 #2697 #2700 #2703 #2708) + +* Changes to ``TLS::Stream`` to make it compatible with generic completion tokens. + (GH #2667 #2648) + +* When creating an ``EC_Group`` from parameters, cause the OID to be set if it + is a known group. (GH #2654 #2649) + * Fix a bug in BigInt::operator< where if two negative numbers were compared, an incorrect result was computed. (GH #2639 #2638) @@ -65,6 +85,16 @@ Version 3.0.0, Not Yet Released of the integer by at least 32 bits, it was possible an exception would be thrown instead of computing the correct result. (GH #2672) +* Remove the entropy source which walked ``/proc`` as it is no longer + required on modern systems. (GH #2692) + +* Remove the entropy source which reads from ``/dev/random`` as it is + supplanted by the extant source one which reads from the system RNG. + (GH #2636) + +* Add a fast path for inversion modulo ``2*o`` with ``o`` odd, and modify RSA + key generation so that ``phi(n)`` is always of this form. (GH #2634) + * Remove deprecated ``Data_Store`` class (GH #2461) * Remove deprecated public member variables of ``OID``, ``Attribute``,
0
81
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
f8ee7ef0172a1b3610f7830dbe1d77726015adc1
Move docs earlier into the build steps This allows it to run concurrently with the compiler.
commit f8ee7ef0172a1b3610f7830dbe1d77726015adc1 Author: Jack Lloyd <[email protected]> Date: Mon Dec 21 14:55:26 2020 -0500 Move docs earlier into the build steps This allows it to run concurrently with the compiler. diff --git a/configure.py b/configure.py index 71856e5a5..bb0016d5c 100755 --- a/configure.py +++ b/configure.py @@ -1975,6 +1975,8 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch, def all_targets(options): yield 'libs' + if options.with_documentation: + yield 'docs' if 'cli' in options.build_targets: yield 'cli' if 'tests' in options.build_targets: @@ -1983,8 +1985,6 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch, yield 'fuzzers' if 'bogo_shim' in options.build_targets: yield 'bogo_shim' - if options.with_documentation: - yield 'docs' def install_targets(options): yield 'libs'
0
22
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c84143c2cb2554213399aee6d31e09d26aece6c8
A bit more BigInt documentation
commit c84143c2cb2554213399aee6d31e09d26aece6c8 Author: lloyd <[email protected]> Date: Mon Apr 4 17:00:17 2011 +0000 A bit more BigInt documentation diff --git a/doc/bigint.txt b/doc/bigint.txt index 1cdc685d3..cf42726cc 100644 --- a/doc/bigint.txt +++ b/doc/bigint.txt @@ -2,14 +2,24 @@ BigInt ======================================== ``BigInt`` is Botan's implementation of a multiple-precision -integer. Thanks to C++'s operator overloading features, using ``BigInt`` is -often quite similar to using a native integer type. The number of functions -related to ``BigInt`` is quite large. You can find most of them in -``botan/bigint.h`` and ``botan/numthry.h``. +integer. Thanks to C++'s operator overloading features, using +``BigInt`` is often quite similar to using a native integer type. The +number of functions related to ``BigInt`` is quite large. You can find +most of them in ``botan/bigint.h`` and ``botan/numthry.h``. -Probably the most important are the encoding/decoding functions, which -transform the normal representation of a ``BigInt`` into some other -form, such as a decimal string. +.. note:: + + If you can, always use expressions of the form ``a += b`` over ``a = + a + b``. The difference can be *very* substantial, because the first + form prevents at least one needless memory allocation, and possibly + as many as three. This will be less of an issue once the library + adopts use of C++0x's rvalue references. + +Encoding Functions +---------------------------------------- + +These transform the normal representation of a ``BigInt`` into some +other form, such as a decimal string: .. cpp:function:: SecureVector<byte> BigInt::encode(const BigInt& n, Encoding enc = Binary) @@ -42,23 +52,52 @@ you want such things, you'll have to do them yourself. unsigned integer or a string. You can also decode an array (a ``byte`` pointer plus a length) into a ``BigInt`` using a constructor. -Efficiency Hints +Number Theory ---------------------------------------- -If you can, always use expressions of the form ``a += b`` over -``a = a + b``. The difference can be *very* substantial, -because the first form prevents at least one needless memory -allocation, and possibly as many as three. - -If you're doing repeated modular exponentiations with the same modulus, create -a ``BarrettReducer`` ahead of time. If the exponent or base is a constant, -use the classes in ``mod_exp.h``. This stuff is all handled for you by -the normal high-level interfaces, of course. - -Never use the low-level MPI functions (those that begin with -``bigint_``). These are completely internal to the library, and -may make arbitrarily strange and undocumented assumptions about their -inputs, and don't check to see if they are true, on the assumption -that only the library itself calls them, and that the library knows -what the assumptions are. The interfaces for these functions can -change completely without notice. +Number theoretic functions available include: + +.. cpp:function:: BigInt gcd(BigInt x, BigInt y) + + Returns the greatest common divisor of x and y + +.. cpp:function:: BigInt lcm(BigInt x, BigInt y) + + Returns an integer z which is the smallest integer such that z % x + == 0 and z % y == 0 + +.. cpp:function:: BigInt inverse_mod(BigInt x, BigInt m) + + Returns the modular inverse of x modulo m, that is, an integer + y such that (x*y) % m == 1. If no such y exists, returns zero. + +.. cpp:function:: BigInt power_mod(BigInt b, BigInt x, BigInt m) + + Returns b to the xth power modulo m. If you are doing many + exponentiations with a single fixed modulus, it is faster to use a + ``Power_Mod`` implementation. + +.. cpp:function:: BigInt ressol(BigInt x, BigInt p) + + Returns the square root modulo a prime, that is, returns a number y + such that (y*y) % p == x. Returns -1 if no such integer exists. + +.. cpp:function:: bool quick_check_prime(BigInt n, RandomNumberGenerator& rng) + +.. cpp:function:: bool check_prime(BigInt n, RandomNumberGenerator& rng) + +.. cpp:function:: bool verify_prime(BigInt n, RandomNumberGenerator& rng) + + Three variations on primality testing. All take an integer to test along with + a random number generator, and return true if the integer seems like it might + be prime; there is a chance that this function will return true even with + a composite number. The probability decreases with the amount of work performed, + so it is much less likely that ``verify_prime`` will return a false positive + than ``check_prime`` will. + +.. cpp:function BigInt random_prime(RandomNumberGenerator& rng, size_t bits, BigInt coprime = 1, size_t equiv = 1, size_t equiv_mod = 2) + + Return a random prime number of ``bits`` bits long that is + relatively prime to ``coprime``, and equivalent to ``equiv`` modulo + ``equiv_mod``. +
0
61
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
1468b5cee2b82439cf90253eef33a5635021ab1a
Deprecate SM2_Enc/SM2_Sig names [ci skip]
commit 1468b5cee2b82439cf90253eef33a5635021ab1a Author: Jack Lloyd <[email protected]> Date: Fri Jun 9 05:25:09 2023 -0400 Deprecate SM2_Enc/SM2_Sig names [ci skip] diff --git a/doc/deprecated.rst b/doc/deprecated.rst index bed76bb04..e86e8f8ec 100644 --- a/doc/deprecated.rst +++ b/doc/deprecated.rst @@ -46,6 +46,12 @@ in a future major release. None of the builtin groups have composite order, and in the future it will be impossible to create composite order EC_Groups. +- Prior to 2.8.0, SM2 algorithms were implemented as two distinct key + types, one used for encryption and the other for signatures. In 2.8, + the two types were merged. However it is still possible to refer to + SM2 using the split names of "SM2_Enc" or "SM2_Sig". In a future major + release this will be removed, and only "SM2" will be recognized. + - DSA, ECDSA, ECGDSA, ECKCDSA, and GOST-34.10 previously (before Botan 3) required that the hash be named as "EMSA1(HASH_NAME)". This is no longer required. In a future major release, only "HASH_NAME" will be accepted.
0
38
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
466eb917f383b94e598c398598d6a2b4e0b96416
Some API doc updates, mostly in the first few sections. Document the new initializer options and techniques, reword some things for clarity, note the availability of an SSH library, and remove the remark that accessing the global state before initialization may crash, since this is no longer the case.
commit 466eb917f383b94e598c398598d6a2b4e0b96416 Author: lloyd <[email protected]> Date: Thu Jul 13 15:38:11 2006 +0000 Some API doc updates, mostly in the first few sections. Document the new initializer options and techniques, reword some things for clarity, note the availability of an SSH library, and remove the remark that accessing the global state before initialization may crash, since this is no longer the case. diff --git a/doc/api.tex b/doc/api.tex index f2846690a..3daf58077 100644 --- a/doc/api.tex +++ b/doc/api.tex @@ -10,9 +10,9 @@ \setlength{\oddsidemargin}{0in} \setlength{\evensidemargin}{0in} -\title{\textbf{Botan API Reference (December 31, 2005)}} +\title{\textbf{Botan API Reference}} \author{} -\date{} +\date{2006/07/13} \newcommand{\filename}[1]{\texttt{#1}} \newcommand{\manpage}[2]{\texttt{#1}(#2)} @@ -54,20 +54,20 @@ form the basic interface for the library. \subsection{Basic Conventions} -With a few exceptions declarations in the library are contained within the -namespace \namespace{Botan}. Botan declares several typedef'ed types to help -buffer it against changes in machine architecture. These types are used -extensively in the interface, and thus it would be often be convenient to use -them without the \namespace{Botan} prefix. You can, by \keyword{using} the -namespace \namespace{Botan\_types} (this way you can use the type names without -the namespace prefix, but the remainder of the library stays out of the global -namespace). The included types are \type{byte} and \type{u32bit}, which are -unsigned integer types. +With a very small number of exceptions, declarations in the library are +contained within the namespace \namespace{Botan}. Botan declares several +typedef'ed types to help buffer it against changes in machine architecture. +These types are used extensively in the interface, and thus it would be often +be convenient to use them without the \namespace{Botan} prefix. You can do so +by \keyword{using} the namespace \namespace{Botan\_types} (this way you can use +the type names without the namespace prefix, but the remainder of the library +stays out of the global namespace). The included types are \type{byte} and +\type{u32bit}, which are unsigned integer types. The headers for Botan are usually available in the form -\filename{botan/headername.h}. For brevity in this documentation, headers are -always just called \filename{headername.h}, but they should be used as -\filename{botan/headername.h} in your actual code. +\filename{botan/headername.h}. For brevity in this documentation, +headers are always just called \filename{headername.h}, but they +should be used with the \filename{botan/} prefix in your actual code. \subsection{Targets} @@ -77,11 +77,13 @@ few megabytes of memory. Generally, given the choice between optimizing for that where performance really matters (servers), people are using 64-bit machines. But performance on 32 bit systems is also quite good. -Today smaller systems, such as handhelds, set-top boxes, and the bigger smart -phones and smart cards, are also capable of using Botan. However, Botan uses a -fairly large amount of code space (multiple megabytes), which could be -prohibitive in some systems. Actual RAM usage is quite small, usually under -64K, though C++ runtime overheads might cause more to be used. +Today smaller systems, such as handhelds, set-top boxes, and the +bigger smart phones and smart cards, are also capable of using +Botan. However, Botan uses a fairly large amount of code space (up to +several megabytes, depending upon the compiler and options used), +which could be prohibitive in some systems. Actual RAM usage is quite +small, usually under 64K, though C++ runtime overheads might require +additional memory. Botan's design makes it quite easy to remove unused algorithms in such a way that applications do not need to be recompiled to work, even applications that @@ -97,7 +99,7 @@ Botan may be the perfect choice for your application. Or it might be a terribly bad idea. This section is basically to make it clear what Botan is and is not. -First, let's cover the major strengths. Botan: +First, let's cover the major strengths: \begin{list}{$\cdot$} \item Support is (usually) quickly available on the project mailing lists. @@ -139,11 +141,10 @@ And the major downsides and deficiencies are: going to be more pain than it's worth. \item - \item Botan doesn't support higher-level protocols and formats like SSL or - OpenPGP. These will eventually be available as separate packages. Of - course you can write it yourself (and I would be happy to help with - that in any way I can). Some work is beginning on TLS and CMS (S/MIME) - support, but it is a ways away still. + \item Botan doesn't directly support higher-level protocols and + formats like SSL or OpenPGP. SSH support is available from a + third-party, and there is an alpha-level SSL/TLS library + currently available. \item Doesn't support elliptic curve algorithms; ECDSA support is planned at some point, but demand seems quite low. @@ -167,9 +168,10 @@ tables, finding out if there is a high resolution timer available to use, and similar such matters. The constructor of this object takes a string which specifies any options. If -more than one is used, they should be separated by a space. The options are -listed here by order of danger (\ie the caution you should have about using the -option), with safest first. +more than one is used, they should be separated by a space. Boolean arguments +(all except for the ``config'' option) can take an argument of ``true'' or +``false'' to explicitly turn them on or off. Simply giving the name of the +option without any argument signifies that the option should be toggled on. \noindent \textbf{Option ``secure\_memory''}: Try to create a more secure allocator type @@ -210,14 +212,11 @@ time, and that a number of changes will be necessary before such a validation can occur. Do not use this option. \noindent -\textbf{Option ``no\_rng\_seed''}: Don't attempt to seed the global PRNGs at -startup. This is primarily useful when you know that the built-in library -entropy sources will not work, and you are providing you own entropy source(s) -with \function{Global\_RNG::add\_es}. By default Botan will attempt to seed the -PRNGs, and will throw an exception if it fails. This options disables both of -these actions; call \function{Global\_RNG::add\_entropy} or -\function{Global\_RNG::add\_es} to add entropy and/or an entropy source, then -call \function{Global\_RNG::seed} to actually seed the RNG. +\textbf{Option ``seed\_rng''}: Attempt to seed the global PRNGs at +startup. This option is toggled on by default, and can be disabled by passing +``seed\_rng=false''. This is primarily useful when you know that the built-in +library entropy sources will not work, and you are providing you own entropy +source(s) with \function{Global\_RNG::add\_es}(). If you do not create a \type{LibraryInitializer} object, pretty much any Botan operation will fail, because it will be unable to do basic things like allocate @@ -241,21 +240,22 @@ impossible and an interface using plain functions is the only option. There are a few things to watch out for to prevent problems when using Botan. -First and primary of these is to \emph{never} allocate any kind of Botan object -globally. The problem is that the constructor for such an object will be called -before the \type{LibraryInitializer} is created, and the constructor will -undoubtedly try to call an object which has not been initialized. If you're -lucky your program will die with an uncaught exception. If you're less lucky, -it will crash from a memory access error. And if you're really unlucky it -\emph{won't} crash, and your program will be in an unknown (but very bad) -state. Use a pointer to an object instead, and initialize it after creating -your \type{LibraryInitializer}. +Never allocate any kind of Botan object globally. The problem with doing this +is that the constructor for such an object will be called before the library is +initialized. Many Botan objects will, in their constructor, make one or more +calls into the library global state object. Access to this object is checked, +so an exception should be thrown (rather than a memory access violation or +undetected uninitialized object access). A rough equivalent which will work is +to keep a global pointer to the object, initializing it after creating your +\type{LibraryInitializer}. Merely making the \type{LibraryInitializer} also +global will probably not help, because C++ does not make very strong guarantees +about the order that such objects will be created. The same rule applies for making sure the destructors of all your Botan objects are called before the \type{LibraryInitializer} is destroyed. This implies you can't have static variables that are Botan objects inside functions or classes (since in most C++ runtimes, these objects will be destroyed after main has -returned). This is kind of inelegant, but rarely a real problem in practice. +returned). This is inelegant, but seems to not cause many problems in practice. Never create a Botan memory object (\type{MemoryVector}, \type{SecureVector}, \type{SecureBuffer}) with a type that is not a basic integer (\type{byte}, @@ -276,7 +276,9 @@ many such changes. Use a \function{try}/\function{catch} block inside your \function{main} function, and catch any \type{std::exception} throws. This is not strictly required, but if you don't, and Botan throws an exception, your application -will die mysteriously and (probably) without any error message. +will die mysteriously and (probably) without any error message. Some compilers +provide a useful diagnostic for an uncaught exception, but others simply abort +the process. \pagebreak @@ -3668,10 +3670,10 @@ Another key, with fingerprint releases up to version 1.4.2. This key has been retired. \vskip 5pt \noindent -Main email contact: \verb|[email protected]| +Web Site: \verb|http://botan.randombit.net| \vskip 5pt \noindent -Web Site: \verb|http://botan.randombit.net| +Mailing lists: \verb|http://www.randombit.net/mailman/| \pagebreak
0
96
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
6030502da52089b255bfcd95856e432d9db9a1e7
Remove obsolete doc See also GH #1113
commit 6030502da52089b255bfcd95856e432d9db9a1e7 Author: Jack Lloyd <[email protected]> Date: Thu Nov 9 17:05:50 2017 -0500 Remove obsolete doc See also GH #1113 diff --git a/doc/manual/x509.rst b/doc/manual/x509.rst index 72a7b32b7..1fb6d90f5 100644 --- a/doc/manual/x509.rst +++ b/doc/manual/x509.rst @@ -79,19 +79,6 @@ associated with a position of some sort in the organization. It may also include fields for state/province and locality. What a locality is, nobody knows, but it's usually given as a city name. -Botan doesn't currently support any of the Unicode variants used in -ASN.1 (UTF-8, UCS-2, and UCS-4), any of which could be used for the -fields in the DN. This could be problematic, particularly in Asia and -other areas where non-ASCII characters are needed for most names. The -UTF-8 and UCS-2 string types *are* accepted (in fact, UTF-8 is used -when encoding much of the time), but if any of the characters included -in the string are not in ISO 8859-1 (ie 0 ... 255), an exception will -get thrown. Currently the ``ASN1_String`` type holds its data as ISO -8859-1 internally (regardless of local character set); this would have -to be changed to hold UCS-2 or UCS-4 in order to support Unicode -(also, many interfaces in the X.509 code would have to accept or -return a ``std::wstring`` instead of a ``std::string``). - Like the distinguished names, subject alternative names can contain a lot of things that Botan will flat out ignore (most of which you would likely never want to use). However, there are three very useful pieces of information that
0
85
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a2a7cdd0971199e2bdaa1239cc26132a2071e25f
enforce internal/virtual module constraints
commit a2a7cdd0971199e2bdaa1239cc26132a2071e25f Author: Rene Meusel <[email protected]> Date: Mon Aug 8 15:24:32 2022 +0200 enforce internal/virtual module constraints diff --git a/configure.py b/configure.py index d03d192cb..8c03f1b6b 100755 --- a/configure.py +++ b/configure.py @@ -895,6 +895,11 @@ class ModuleInfo(InfoObject): intersect_check('public', self.header_public, 'external', self.header_external) intersect_check('external', self.header_external, 'internal', self.header_internal) + # Check module type constraints + source_file_count = len(all_source_files) + len(all_header_files) + if self.is_virtual() and source_file_count > 0: + logging.error("Module '%s' is virtual but contains %d source code files", self.basename, source_file_count) + def _parse_module_info(self, lex): try: info = lex.module_info @@ -1082,11 +1087,34 @@ class ModuleInfo(InfoObject): about any that do not """ - missing = [s for s in self.dependencies(None) if s not in modules] + def is_dependency_on_virtual(this_module, dependency): + if not dependency.is_virtual(): + return False + + if this_module.parent_module == dependency.basename: + return False + + return True + + missing = [s for s in self.dependencies(None) if s not in modules or is_dependency_on_virtual(self, modules[s])] - if missing: - logging.error("Module '%s', dep of '%s', does not exist", - missing, self.basename) + for modname in missing: + if modname not in modules: + logging.error("Module '%s', dep of '%s', does not exist", + missing, self.basename) + else: + assert modules[modname].is_virtual() + logging.error("Module '%s' is virtual and cannot be depended on by '%s'", + modname, self.basename) + + def is_public(self): + return self.type == "Public" + + def is_internal(self): + return self.type == "Internal" + + def is_virtual(self): + return self.type == "Virtual" class ModulePolicyInfo(InfoObject): def __init__(self, infofile): @@ -2289,15 +2317,19 @@ class ModulesChooser(object): return True @staticmethod - def _display_module_information_unused(skipped_modules): + def _remove_virtual_modules(all_modules, modnames): + return [mod for mod in modnames if not all_modules[mod].is_virtual()] + + @classmethod + def _display_module_information_unused(cls, all_modules, skipped_modules): for reason in sorted(skipped_modules.keys()): - disabled_mods = sorted(skipped_modules[reason]) + disabled_mods = cls._remove_virtual_modules(all_modules, sorted(skipped_modules[reason])) if disabled_mods: logging.info('Skipping (%s): %s', reason, ' '.join(disabled_mods)) - @staticmethod - def _display_module_information_to_load(all_modules, modules_to_load): - sorted_modules_to_load = sorted(modules_to_load) + @classmethod + def _display_module_information_to_load(cls, all_modules, modules_to_load): + sorted_modules_to_load = cls._remove_virtual_modules(all_modules, sorted(modules_to_load)) for modname in sorted_modules_to_load: if all_modules[modname].comment: @@ -2331,23 +2363,31 @@ class ModulesChooser(object): for modname in enabled_modules: if modname not in modules: logging.error("Module not found: %s", modname) + if not modules[modname].is_public(): + logging.error("Module '%s' is meant for internal use only", modname) for modname in disabled_modules: if modname not in modules: logging.warning("Disabled module not found: %s", modname) + if not modules[modname].is_public(): + logging.error("Module '%s' is meant for internal use only", modname) - def _handle_by_module_policy(self, modname, usable): + def _handle_by_module_policy(self, modname, module, usable): if self._module_policy is not None: if modname in self._module_policy.required: if not usable: logging.error('Module policy requires module %s not usable on this platform', modname) elif modname in self._options.disabled_modules: logging.error('Module %s was disabled but is required by policy', modname) + elif module.is_virtual(): + logging.error("Module %s is meant for internal use only", modname) self._to_load.add(modname) return True elif modname in self._module_policy.if_available: if modname in self._options.disabled_modules: self._not_using_because['disabled by user'].add(modname) + elif module.is_virtual(): + logging.error("Module %s is meant for internal use only", modname) elif usable: logging.debug('Enabling optional module %s', modname) self._to_load.add(modname) @@ -2461,7 +2501,7 @@ class ModulesChooser(object): for (modname, module) in self._modules.items(): usable = self._check_usable(module, modname) - module_handled = self._handle_by_module_policy(modname, usable) + module_handled = self._handle_by_module_policy(modname, module, usable) if module_handled: continue @@ -2487,7 +2527,7 @@ class ModulesChooser(object): self._not_using_because['not requested'].add(not_a_dep) ModulesChooser._validate_state(self._to_load, self._not_using_because) - ModulesChooser._display_module_information_unused(self._not_using_because) + ModulesChooser._display_module_information_unused(self._modules, self._not_using_because) ModulesChooser._display_module_information_to_load(self._modules, self._to_load) return self._to_load @@ -3354,7 +3394,8 @@ def main(argv): info_modules = load_info_files(source_paths.lib_dir, 'Modules', "info.txt", ModuleInfo) if options.list_modules: - for mod in sorted(info_modules.keys()): + public_modules = [name for (name, info) in info_modules.items() if info.is_public()] + for mod in sorted(public_modules): print(mod) return 0
0
13
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
d490659cd20c73f5e269b2e5f471512927df8ca7
Prevent a crash in GMP_Engine if the library is shutdown and then reinitialized. It would cache an Allocator pointer on first use, and then never zero it, so after the reinit the pointer would be going to a now deallocated Allocator object. Encountered in the SoftHSM test suite, reported by Ondrej Sury. Use a simple reference counting scheme to zero the pointer, and reset the GNU MP memory functions. This also fixes a quite obscure and never reported bug, that if the GMP engine was used, and if the library was deinitialized but then the program tried to use GNU MP, the allocator functions would crash. Now after deinit the allocator funcs revert to the defaults. The reference count is not updated atomically so this is not thread safe, but seems a non-issue; the only time this could happen (especially now that the GMP engine header is internal-only) is if multiple threads were attempting to initialize / shutdown the library at once - which won't work anyway for a variety of reasons, including contention on the (unlocked) global_lib_state pointer. If at some point thread safety is useful here, the refcnt can be locked by a mutex, or kept in an atomic<unsigned int>.
commit d490659cd20c73f5e269b2e5f471512927df8ca7 Author: lloyd <[email protected]> Date: Fri Jan 22 20:57:42 2010 +0000 Prevent a crash in GMP_Engine if the library is shutdown and then reinitialized. It would cache an Allocator pointer on first use, and then never zero it, so after the reinit the pointer would be going to a now deallocated Allocator object. Encountered in the SoftHSM test suite, reported by Ondrej Sury. Use a simple reference counting scheme to zero the pointer, and reset the GNU MP memory functions. This also fixes a quite obscure and never reported bug, that if the GMP engine was used, and if the library was deinitialized but then the program tried to use GNU MP, the allocator functions would crash. Now after deinit the allocator funcs revert to the defaults. The reference count is not updated atomically so this is not thread safe, but seems a non-issue; the only time this could happen (especially now that the GMP engine header is internal-only) is if multiple threads were attempting to initialize / shutdown the library at once - which won't work anyway for a variety of reasons, including contention on the (unlocked) global_lib_state pointer. If at some point thread safety is useful here, the refcnt can be locked by a mutex, or kept in an atomic<unsigned int>. diff --git a/doc/log.txt b/doc/log.txt index 3db4205f3..ef16d85bf 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -7,6 +7,7 @@ - Add SQLite3 db encryption codec, contributed by Olivier de Gaalon - Add a block cipher cascade construction - Add support for Win32 high resolution system timers + - Fix crash in GMP_Engine if library is shutdown and reinitialized - Remove Timer class entirely - Switch default PKCS #8 encryption algorithm from 3DES to AES-256 - New option --gen-amalgamation for creating a SQLite-style amalgamation diff --git a/src/engine/gnump/gmp_mem.cpp b/src/engine/gnump/gmp_mem.cpp index 59e0cc4c5..f3650e716 100644 --- a/src/engine/gnump/gmp_mem.cpp +++ b/src/engine/gnump/gmp_mem.cpp @@ -1,6 +1,6 @@ /* * GNU MP Memory Handlers -* (C) 1999-2007 Jack Lloyd +* (C) 1999-2010 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -17,6 +17,7 @@ namespace { * Allocator used by GNU MP */ Allocator* gmp_alloc = 0; +u32bit gmp_alloc_refcnt = 0; /* * Allocation Function for GNU MP @@ -48,23 +49,28 @@ void gmp_free(void* ptr, size_t n) } /* -* Set the GNU MP memory functions +* GMP_Engine Constructor */ -void GMP_Engine::set_memory_hooks() +GMP_Engine::GMP_Engine() { if(gmp_alloc == 0) { gmp_alloc = Allocator::get(true); mp_set_memory_functions(gmp_malloc, gmp_realloc, gmp_free); } + + ++gmp_alloc_refcnt; } -/* -* GMP_Engine Constructor -*/ -GMP_Engine::GMP_Engine() +GMP_Engine::~GMP_Engine() { - set_memory_hooks(); + --gmp_alloc_refcnt; + + if(gmp_alloc_refcnt == 0) + { + mp_set_memory_functions(NULL, NULL, NULL); + gmp_alloc = 0; + } } } diff --git a/src/engine/gnump/gnump_engine.h b/src/engine/gnump/gnump_engine.h index ec4a7e721..d0b070441 100644 --- a/src/engine/gnump/gnump_engine.h +++ b/src/engine/gnump/gnump_engine.h @@ -18,6 +18,9 @@ namespace Botan { class GMP_Engine : public Engine { public: + GMP_Engine(); + ~GMP_Engine(); + std::string provider_name() const { return "gmp"; } #if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) @@ -46,10 +49,6 @@ class GMP_Engine : public Engine Modular_Exponentiator* mod_exp(const BigInt&, Power_Mod::Usage_Hints) const; - - GMP_Engine(); - private: - static void set_memory_hooks(); }; }
0
14
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
1f301aab31013e36a0eccb39bee057c07205d6cd
Document the erroneous removal of pk_ops.h
commit 1f301aab31013e36a0eccb39bee057c07205d6cd Author: Rene Meusel <[email protected]> Date: Wed Jan 10 11:12:36 2024 +0100 Document the erroneous removal of pk_ops.h diff --git a/doc/migration_guide.rst b/doc/migration_guide.rst index ce742a738..c2a4c75df 100644 --- a/doc/migration_guide.rst +++ b/doc/migration_guide.rst @@ -26,6 +26,14 @@ algorithm headers (such as ``aes.h``) have been removed. Instead you should create objects via the factory methods (in the case of AES, ``BlockCipher::create``) which works in both 2.x and 3.0 +Errata: ``pk_ops.h`` +^^^^^^^^^^^^^^^^^^^^ + +Between Botan 3.0 and 3.2 the public header ``pk_ops.h`` was removed +accidentally. This header is typically required for specialized applications +that interface with dedicated crypto hardware. If you are migrating such an +application, please make sure to use Botan 3.3 or newer. + Build Artifacts --------------- diff --git a/src/lib/pubkey/pk_ops.h b/src/lib/pubkey/pk_ops.h index e9174359a..d6a9f046d 100644 --- a/src/lib/pubkey/pk_ops.h +++ b/src/lib/pubkey/pk_ops.h @@ -16,6 +16,11 @@ * Unless you're doing something like that, you don't need anything * here. Instead use pubkey.h which wraps these types safely and * provides a stable application-oriented API. +* +* Note: This header was accidentally pulled from the public API between +* Botan 3.0.0 and 3.2.0, and then restored in 3.3.0. If you are +* maintaining an application which used this header in Botan 2.x, +* you should make sure to use Botan 3.3.0 or later when migrating. */ #include <botan/pk_keys.h>
0
66
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
9b5e3fb65e660d6b4830acdd50bda8f0165c5181
Deprecate MD4 Somehow this missed deprecation last time around, so stuck with it for a while yet. Update the hash docs with stronger warnings about weak hashes.
commit 9b5e3fb65e660d6b4830acdd50bda8f0165c5181 Author: Jack Lloyd <[email protected]> Date: Mon Dec 14 06:49:37 2020 -0500 Deprecate MD4 Somehow this missed deprecation last time around, so stuck with it for a while yet. Update the hash docs with stronger warnings about weak hashes. diff --git a/doc/api_ref/hash.rst b/doc/api_ref/hash.rst index 56fd76aa8..710e78b93 100644 --- a/doc/api_ref/hash.rst +++ b/doc/api_ref/hash.rst @@ -149,17 +149,22 @@ new code. MD4 ^^^^^^^^^ -Available if ``BOTAN_HAS_MD4`` is defined. +An old and now broken hash function. Available if ``BOTAN_HAS_MD4`` is defined. -An old hash function that is now known to be trivially breakable. It is very -fast, and may still be suitable as a (non-cryptographic) checksum. +.. warning:: + MD4 collisions can be easily created. There is no safe cryptographic use + for this function. + +.. warning:: + Support for MD4 is deprecated and will be removed in a future major release. MD5 ^^^^^^^^^ -Available if ``BOTAN_HAS_MD5`` is defined. +An old and now broken hash function. Available if ``BOTAN_HAS_MD5`` is defined. -Widely used, now known to be broken. +.. warning:: + MD5 collisions can be easily created. MD5 should never be used for signatures. RIPEMD-160 ^^^^^^^^^^^^^^^ @@ -168,15 +173,20 @@ Available if ``BOTAN_HAS_RIPEMD160`` is defined. A 160 bit hash function, quite old but still thought to be secure (up to the limit of 2**80 computation required for a collision which is possible with any -160 bit hash function). Somewhat deprecated these days. +160 bit hash function). Somewhat deprecated these days. Prefer SHA-2 or SHA-3 +in new code. SHA-1 ^^^^^^^^^^^^^^^ Available if ``BOTAN_HAS_SHA1`` is defined. -Widely adopted NSA designed hash function. Starting to show significant signs of -weakness, and collisions can now be generated. Avoid in new designs. +Widely adopted NSA designed hash function. Use SHA-2 or SHA-3 in new code. + +.. warning:: + + SHA-1 collisions can now be created by moderately resourced attackers. It + must never be used for signatures. SHA-256 ^^^^^^^^^^^^^^^ @@ -214,17 +224,7 @@ Available if ``BOTAN_HAS_SHAKE`` is defined. These are actually XOFs (extensible output functions) based on SHA-3, which can output a value of any byte length. For example "SHAKE-128(1024)" will produce -1024 bits of output. The specified length must be a multiple of 8. Not -specifying an output length, "SHAKE-128" defaults to a 128-bit output and -"SHAKE-256" defaults to a 256-bit output. - -.. warning:: - In the case of SHAKE-128, the default output length in insufficient - to ensure security. The choice of default lengths was a bug which is - currently retained for compatability; they should have been 256 and - 512 bits resp to match SHAKE's security level. Using the default - lengths with SHAKE is deprecated and will be removed in a future major - release. Instead, always specify the desired output length. +1024 bits of output. The specified length must be a multiple of 8. SM3 ^^^^^^^^^^^^^^^ diff --git a/doc/deprecated.rst b/doc/deprecated.rst index 1a5e6060a..f221c9a12 100644 --- a/doc/deprecated.rst +++ b/doc/deprecated.rst @@ -48,7 +48,7 @@ in a future major release. - Block cipher GOST 28147, Noekeon -- Hash function GOST 34.11-94 +- Hash function GOST 34.11-94, MD4 - X9.42 KDF diff --git a/readme.rst b/readme.rst index f692488d4..2f97bb125 100644 --- a/readme.rst +++ b/readme.rst @@ -110,10 +110,10 @@ Ciphers, hashes, MACs, and checksums * Authenticated cipher modes EAX, OCB, GCM, SIV, CCM, (X)ChaCha20Poly1305 * Cipher modes CTR, CBC, XTS, CFB, OFB * Block ciphers AES, ARIA, Blowfish, Camellia, CAST-128, DES/3DES, IDEA, - Lion, Noekeon, SEED, Serpent, SHACAL2, SM4, Threefish-512, Twofish + Lion, SEED, Serpent, SHACAL2, SM4, Threefish-512, Twofish * Stream ciphers (X)ChaCha20, (X)Salsa20, SHAKE-128, RC4 -* Hash functions SHA-1, SHA-2, SHA-3, MD4, MD5, RIPEMD-160, BLAKE2b, - Skein-512, SM3, Streebog, Whirlpool +* Hash functions SHA-1, SHA-2, SHA-3, MD5, RIPEMD-160, BLAKE2b, + Skein-512, SM3, Streebog, Whirlpool * Authentication codes HMAC, CMAC, Poly1305, SipHash, GMAC, X9.19 DES-MAC * Non-cryptographic checksums Adler32, CRC24, CRC32
0
49
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
7f07c452a1cf8de2589207e4778a305ea86c413a
Mention CMake configuration in docs
commit 7f07c452a1cf8de2589207e4778a305ea86c413a Author: Rene Meusel <[email protected]> Date: Mon Dec 11 12:12:42 2023 +0100 Mention CMake configuration in docs diff --git a/doc/building.rst b/doc/building.rst index ef08c1a56..0be5b8b96 100644 --- a/doc/building.rst +++ b/doc/building.rst @@ -540,6 +540,21 @@ is less of a problem - only the developer needs to worry about it. As long as they can remember where they installed Botan, they just have to set the appropriate flags in their Makefile/project file. +CMake +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Starting in Botan 3.3.0 we provide a ``botan-config.cmake`` module to +discover the installed library binaries and headers. This hooks into +CMake's ``find_package()`` and comes with common features like version +detection. Also, library consumers may specify which botan modules they +require in ``find_package()``. + +Examples:: + + find_package(Botan 3.3.0) + find_package(Botan 3.3.0 COMPONENTS rsa ecdsa tls13) + find_package(Botan 3.3.0 OPTIONAL_COMPONENTS tls13_pqc) + Language Wrappers ---------------------------------------- diff --git a/doc/packaging.rst b/doc/packaging.rst index 3d3c13840..8680ece4f 100644 --- a/doc/packaging.rst +++ b/doc/packaging.rst @@ -34,6 +34,18 @@ releases and packages. Any value set with ``--distribution-info`` flag will be included in the version string, and can read through the ``BOTAN_DISTRIBUTION_INFO`` macro. +CMake Integration +----------------- + +Starting in Botan 3.3.0, we ship ``botan-config.cmake`` files. While this config +file is somewhat relocatable, it assumes the default installation directory +structure as generated by ``make install``. If your distribution changes the +directory layout of the installed files you might want to either adapt the final +``botan-config.cmake`` file accordingly or leave it out entirely. + +Please don't hesitate to give your feedback on this new feature by opening a +ticket on the upstream GitHub. + Minimize Distribution Patches ------------------------------
0
70
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
bc6b677ef3e0fce4257c9dbeb6e3c6a46ad41a51
Add a doc with notes/reminders for when Botan4 forks [ci skip]
commit bc6b677ef3e0fce4257c9dbeb6e3c6a46ad41a51 Author: Jack Lloyd <[email protected]> Date: Sat Jul 6 05:02:17 2024 -0400 Add a doc with notes/reminders for when Botan4 forks [ci skip] diff --git a/doc/dev_ref/next_major.rst b/doc/dev_ref/next_major.rst new file mode 100644 index 000000000..7fe016455 --- /dev/null +++ b/doc/dev_ref/next_major.rst @@ -0,0 +1,39 @@ +Checklist For Next Major Version +================================== + +* Remove most/all explicitly deprecated modules, interfaces, and features. + Check deprecated.rst plus BOTAN_DEPRECATED annotations. + +* Make the remaining PasswordHash interfaces internal + +* Remove EC_Point/CurveGFp + + +Big Project: Public Key Split +------------------------------- + +Some complications of this aren't going to become clear until we get +into it... + +A number of operations currently defined on Public_Key can be +moved to Asymetric_Key, for example key_length and algorithm_identifier. + +Due to Private_Key deriving from Public_Key, the fingerprint functions +are oddly named. Otherwise we can't correctly disambiguate sk->fingerprint(); +should this be the fingerprint of the public or private key. With the +split we can move this to Asymetric_Key::fingerprint and know that the +correct thing happens. + +The public and private key encoding functions (pkcs8.h, x509_key.h) +are also complicated by the combined keys. For example we have to use +PKCS8::PEM_encode(key) because key.PEM_encode() would be ambigious +(similar situation as with the fingerprint APIs currently). Once the +key types are split, we can move all of this to the key types +themselves, or again (for the shared cases, like unencrypted PEM) to +Asymetric_Key. + +Decoding also can become simpler. We could consider moving to a model +that doesn't use DataSource? Maybe just a span even? + +Put `_` prefixes on all of the internal operations getters +(create_signature_op, etc)
0
63
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
ea0d613ed1bfd520ff697b877fe02dc1e0d1bd40
New TLS session encryption format Changes: - Adds magic number/versioning to make future extensions possible - Adds key identifier to avoid needless decryption attempts, makes supporting ticket key rotation easier in the future - Avoids key collision; in current format if the seed is duplicated the same key + nonce are generated. This does not leak the master ticket key but is still bad. Now nonce is random, and key is generated via a distinct 128-bit long input. Chances of a duplicated key/nonce are now about 2^-112. - Include the whole header incl nonce as associated data - Use SHA-512-256 instead of SHA-256 This breaks all saved encrypted sessions as well as saved session tickets. But the cost then is just a full renegotiation. The session ticket format is not guaranteed to be stable even across minor releases.
commit ea0d613ed1bfd520ff697b877fe02dc1e0d1bd40 Author: Jack Lloyd <[email protected]> Date: Fri Sep 13 06:15:55 2019 -0400 New TLS session encryption format Changes: - Adds magic number/versioning to make future extensions possible - Adds key identifier to avoid needless decryption attempts, makes supporting ticket key rotation easier in the future - Avoids key collision; in current format if the seed is duplicated the same key + nonce are generated. This does not leak the master ticket key but is still bad. Now nonce is random, and key is generated via a distinct 128-bit long input. Chances of a duplicated key/nonce are now about 2^-112. - Include the whole header incl nonce as associated data - Use SHA-512-256 instead of SHA-256 This breaks all saved encrypted sessions as well as saved session tickets. But the cost then is just a full renegotiation. The session ticket format is not guaranteed to be stable even across minor releases. diff --git a/doc/api_ref/tls.rst b/doc/api_ref/tls.rst index 1980e094b..8569a89c1 100644 --- a/doc/api_ref/tls.rst +++ b/doc/api_ref/tls.rst @@ -669,8 +669,8 @@ information about that session: .. note:: The serialization format of Session is not considered stable and is allowed - to change even within a single major release cycle. In the event of such a - change, old sessions will no longer be able to be resumed. + to change even across minor releases. In the event of such a change, old + sessions will no longer be able to be resumed. .. cpp:class:: TLS::Session @@ -1889,27 +1889,27 @@ A unified format is used for encrypting TLS sessions either for durable storage (on client or server) or when creating TLS session tickets. This format is *not stable* even across the same major version. -The current session encryption scheme was introduced in 1.11.13. +The current session encryption scheme was introduced in 2.13.0, replacing the +format previously used since 1.11.13. Session encryption accepts a key of any length, though for best security a key of 256 bits should be used. This master key is used to key an instance of HMAC -using the SHA-256 hash. +using the SHA-512/256 hash. -A random 96 bit nonce is created and included in the header. Then the nonce is -hashed using the keyed HMAC to produce a 256-bit GCM key. This key and nonce -pair are used to encrypt the session. +First a "key name" or identifier is created, by HMAC'ing the fixed string "BOTAN +TLS SESSION KEY NAME" and truncating to 4 bytes. This is the initial prefix of +the encrypted session, and will remain fixed as long as the same ticket key is +used. This allows quickly rejecting sessions which are encrypted using an +unknown or incorrect key. -The current design is unfortunate in several ways: +Then a key used for AES-256 in GCM mode is created by first choosing a 128 bit +random seed, and HMAC'ing it to produce a 256-bit value. This means for any one +master key as many as 2\ :sup:`128` GCM keys can be created. This is done +because NIST recommends that when using random nonces no one GCM key be used to +encrypt more than 2\ :sup:`32` messages (to avoid the possiblity of nonce +reuse). - * If the random 96-bit nonce ever repeats, then the same GCM key *and nonce* - are used to encrypt 2 different sessions, breaking the security of sessions - encrypted using that duplicated key/nonce. The GCM nonce should have been - independently created and included in the header, making a key collision - harmless. - - * There is no simple way to detect old or rotated keys, except by attempting - decryption. Instead a key identifier should be included in the header. - - * There is no indicator of the format used, which makes handling format - upgrades without breaking compatability awkward. +A random 96-bit nonce is created and included in the header. +AES in GCM is used to encrypt and authenticate the serialized session. The +key name, key seed, and AEAD nonce are all included as additional data. diff --git a/src/lib/tls/info.txt b/src/lib/tls/info.txt index d81cbb997..690bd4150 100644 --- a/src/lib/tls/info.txt +++ b/src/lib/tls/info.txt @@ -1,5 +1,5 @@ <defines> -TLS -> 20150319 +TLS -> 20191210 </defines> <header:public> diff --git a/src/lib/tls/tls_session.cpp b/src/lib/tls/tls_session.cpp index 0f603454b..7d1bd7200 100644 --- a/src/lib/tls/tls_session.cpp +++ b/src/lib/tls/tls_session.cpp @@ -1,11 +1,12 @@ /* * TLS Session State -* (C) 2011-2012,2015 Jack Lloyd +* (C) 2011-2012,2015,2019 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #include <botan/tls_session.h> +#include <botan/loadstor.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> #include <botan/asn1_str.h> @@ -176,48 +177,114 @@ std::chrono::seconds Session::session_age() const std::chrono::system_clock::now() - m_start_time); } +namespace { + +// The output length of the HMAC must be a valid keylength for the AEAD +const char* TLS_SESSION_CRYPT_HMAC = "HMAC(SHA-512-256)"; +// SIV would be better, but we can't assume it is available +const char* TLS_SESSION_CRYPT_AEAD = "AES-256/GCM"; +const char* TLS_SESSION_CRYPT_KEY_NAME = "BOTAN TLS SESSION KEY NAME"; +const uint64_t TLS_SESSION_CRYPT_MAGIC = 0x068B5A9D396C0000; +const size_t TLS_SESSION_CRYPT_MAGIC_LEN = 8; +const size_t TLS_SESSION_CRYPT_KEY_NAME_LEN = 4; +const size_t TLS_SESSION_CRYPT_AEAD_NONCE_LEN = 12; +const size_t TLS_SESSION_CRYPT_AEAD_KEY_SEED_LEN = 16; +const size_t TLS_SESSION_CRYPT_AEAD_TAG_SIZE = 16; + +const size_t TLS_SESSION_CRYPT_HDR_LEN = + TLS_SESSION_CRYPT_MAGIC_LEN + + TLS_SESSION_CRYPT_KEY_NAME_LEN + + TLS_SESSION_CRYPT_AEAD_NONCE_LEN + + TLS_SESSION_CRYPT_AEAD_KEY_SEED_LEN; + +const size_t TLS_SESSION_CRYPT_OVERHEAD = + TLS_SESSION_CRYPT_HDR_LEN + TLS_SESSION_CRYPT_AEAD_TAG_SIZE; + +} + std::vector<uint8_t> Session::encrypt(const SymmetricKey& key, RandomNumberGenerator& rng) const { - std::unique_ptr<AEAD_Mode> aead = AEAD_Mode::create_or_throw("AES-256/GCM", ENCRYPTION); - const size_t nonce_len = aead->default_nonce_length(); - - const secure_vector<uint8_t> nonce = rng.random_vec(nonce_len); - const secure_vector<uint8_t> bits = this->DER_encode(); - - // Support any length key for input - std::unique_ptr<MessageAuthenticationCode> hmac(MessageAuthenticationCode::create("HMAC(SHA-256)")); + auto hmac = MessageAuthenticationCode::create_or_throw(TLS_SESSION_CRYPT_HMAC); hmac->set_key(key); - hmac->update(nonce); - aead->set_key(hmac->final()); - secure_vector<uint8_t> buf = nonce; + // First derive the "key name" + std::vector<uint8_t> key_name(hmac->output_length()); + hmac->update(TLS_SESSION_CRYPT_KEY_NAME); + hmac->final(key_name.data()); + key_name.resize(TLS_SESSION_CRYPT_KEY_NAME_LEN); + + std::vector<uint8_t> aead_nonce; + std::vector<uint8_t> key_seed; + + rng.random_vec(aead_nonce, TLS_SESSION_CRYPT_AEAD_NONCE_LEN); + rng.random_vec(key_seed, TLS_SESSION_CRYPT_AEAD_KEY_SEED_LEN); + + hmac->update(key_seed); + const secure_vector<uint8_t> aead_key = hmac->final(); + + secure_vector<uint8_t> bits = this->DER_encode(); + + // create the header + std::vector<uint8_t> buf; + buf.reserve(TLS_SESSION_CRYPT_OVERHEAD + bits.size()); + buf.resize(TLS_SESSION_CRYPT_MAGIC_LEN); + store_be(TLS_SESSION_CRYPT_MAGIC, &buf[0]); + buf += key_name; + buf += key_seed; + buf += aead_nonce; + + std::unique_ptr<AEAD_Mode> aead = AEAD_Mode::create_or_throw(TLS_SESSION_CRYPT_AEAD, ENCRYPTION); + BOTAN_ASSERT_NOMSG(aead->valid_nonce_length(TLS_SESSION_CRYPT_AEAD_NONCE_LEN)); + BOTAN_ASSERT_NOMSG(aead->tag_size() == TLS_SESSION_CRYPT_AEAD_TAG_SIZE); + aead->set_key(aead_key); + aead->set_associated_data_vec(buf); + aead->start(aead_nonce); + aead->finish(bits, 0); + + // append the ciphertext buf += bits; - aead->start(buf.data(), nonce_len); - aead->finish(buf, nonce_len); - return unlock(buf); + return buf; } Session Session::decrypt(const uint8_t in[], size_t in_len, const SymmetricKey& key) { try { - std::unique_ptr<AEAD_Mode> aead = AEAD_Mode::create_or_throw("AES-256/GCM", DECRYPTION); - const size_t nonce_len = aead->default_nonce_length(); - - if(in_len < nonce_len + aead->tag_size()) + const size_t min_session_size = 48 + 4; // serious under-estimate + if(in_len < TLS_SESSION_CRYPT_OVERHEAD + min_session_size) throw Decoding_Error("Encrypted session too short to be valid"); - // Support any length key for input - std::unique_ptr<MessageAuthenticationCode> hmac(MessageAuthenticationCode::create("HMAC(SHA-256)")); + const uint8_t* magic = &in[0]; + const uint8_t* key_name = magic + TLS_SESSION_CRYPT_MAGIC_LEN; + const uint8_t* key_seed = key_name + TLS_SESSION_CRYPT_KEY_NAME_LEN; + const uint8_t* aead_nonce = key_seed + TLS_SESSION_CRYPT_AEAD_KEY_SEED_LEN; + const uint8_t* ctext = aead_nonce + TLS_SESSION_CRYPT_AEAD_NONCE_LEN; + const size_t ctext_len = in_len - TLS_SESSION_CRYPT_HDR_LEN; // includes the tag + + if(load_be<uint64_t>(magic, 0) != TLS_SESSION_CRYPT_MAGIC) + throw Decoding_Error("Missing expected magic numbers"); + + auto hmac = MessageAuthenticationCode::create_or_throw(TLS_SESSION_CRYPT_HMAC); hmac->set_key(key); - hmac->update(in, nonce_len); // nonce bytes - aead->set_key(hmac->final()); - aead->start(in, nonce_len); - secure_vector<uint8_t> buf(in + nonce_len, in + in_len); - aead->finish(buf, 0); + // First derive and check the "key name" + std::vector<uint8_t> cmp_key_name(hmac->output_length()); + hmac->update(TLS_SESSION_CRYPT_KEY_NAME); + hmac->final(cmp_key_name.data()); + if(same_mem(cmp_key_name.data(), key_name, TLS_SESSION_CRYPT_KEY_NAME_LEN) == false) + throw Decoding_Error("Wrong key name for encrypted session"); + + hmac->update(key_seed, TLS_SESSION_CRYPT_AEAD_KEY_SEED_LEN); + const secure_vector<uint8_t> aead_key = hmac->final(); + + auto aead = AEAD_Mode::create_or_throw(TLS_SESSION_CRYPT_AEAD, DECRYPTION); + aead->set_key(aead_key); + aead->set_associated_data(in, TLS_SESSION_CRYPT_HDR_LEN); + aead->start(aead_nonce, TLS_SESSION_CRYPT_AEAD_NONCE_LEN); + secure_vector<uint8_t> buf(ctext, ctext + ctext_len); + aead->finish(buf, 0); return Session(buf.data(), buf.size()); } catch(std::exception& e)
0
31
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
3739081a4de5cc70695dd210c38cd64611c53665
Update version to 2.3.0, add release notes
commit 3739081a4de5cc70695dd210c38cd64611c53665 Author: Jack Lloyd <[email protected]> Date: Tue Aug 15 14:53:49 2017 -0400 Update version to 2.3.0, add release notes diff --git a/botan_version.py b/botan_version.py index aea54e47c..311560cac 100644 --- a/botan_version.py +++ b/botan_version.py @@ -1,6 +1,6 @@ release_major = 2 -release_minor = 2 +release_minor = 3 release_patch = 0 release_so_abi_rev = 2 diff --git a/news.rst b/news.rst index a52d3816a..6521b9fb9 100644 --- a/news.rst +++ b/news.rst @@ -1,6 +1,22 @@ Release Notes ======================================== +Version 2.3.0, Not Yet Released +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Add the SHACAL2 block cipher (GH #1151) + +* Optimized the CMAC polynomial doubling operation, and removed a + small timing channel due to a conditional operation. + +* Workaround a GCC 7 bug that caused miscompilation of + the GOST-34.11 hash function on x86-32. (GH #882 #1148) + +* Silence a Clang warning in create_private_key (GH #1150) + +* Fix a bug in FFI tests that caused the test files not to be found + when using `--data-dir` option (GH #1149) + Version 2.2.0, 2017-08-07 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0
60
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c184cd88ab53a8e2c343be0ab3a8517a964789e7
Add a new option --no-autoload to configure.py. This will produce a minimal build (only libstate, utils, plus dependencies), which can be extended with use of --enable-modules. To add new modules to the set of always-loaded, use 'load_on always' in info.txt Also fix a few small build problems that popped up when doing a minimal build. Requested by a user.
commit c184cd88ab53a8e2c343be0ab3a8517a964789e7 Author: lloyd <[email protected]> Date: Fri Sep 4 15:37:39 2009 +0000 Add a new option --no-autoload to configure.py. This will produce a minimal build (only libstate, utils, plus dependencies), which can be extended with use of --enable-modules. To add new modules to the set of always-loaded, use 'load_on always' in info.txt Also fix a few small build problems that popped up when doing a minimal build. Requested by a user. diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index a944934fb..88a72afde 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -675,6 +675,8 @@ void bench_pk(RandomNumberGenerator& rng, benchmark_dsa_nr<NR_PrivateKey>(rng, seconds, report); #endif +#if defined(BOTAN_HAS_RW) if(algo == "All" || algo == "RW") benchmark_rw(rng, seconds, report); +#endif } diff --git a/configure.pl b/configure.pl index 592eb2bff..6cf43e5e6 100755 --- a/configure.pl +++ b/configure.pl @@ -520,6 +520,7 @@ sub scan_modules { next unless(module_runs_on($config, \%modinfo, $mod, 0)); if($modinfo{'load_on'} eq 'auto' or + $modinfo{'load_on'} eq 'always' or ($modinfo{'load_on'} eq 'asm_ok' and $$config{'asm_ok'})) { my %maybe_load = (); diff --git a/configure.py b/configure.py index d1bd46cb5..d2fd1535f 100755 --- a/configure.py +++ b/configure.py @@ -164,6 +164,8 @@ def process_command_line(args): mods_group.add_option('--disable-modules', dest='disabled_modules', metavar='MODS', action='append', default=[], help='disable specific modules') + mods_group.add_option('--no-autoload', action='store_true', default=False, + help='disable automatic loading') for mod in ['openssl', 'gnump', 'bzip2', 'zlib']: @@ -799,10 +801,22 @@ def choose_modules_to_use(options, modules): cannot_use_because(modname, 'loaded on request only') elif module.load_on == 'dep': maybe_dep.append(modname) - elif module.load_on in ['auto', 'asm_ok']: - if module.load_on == 'asm_ok' and not options.asm_ok: + + elif module.load_on == 'always': + to_load.append(modname) + + elif module.load_on == 'asm_ok': + if options.asm_ok: + if options.no_autoload: + maybe_dep.append(modname) + else: + to_load.append(modname) + else: cannot_use_because(modname, 'uses assembly and --disable-asm set') + elif module.load_on == 'auto': + if options.no_autoload: + maybe_dep.append(modname) else: to_load.append(modname) else: @@ -847,6 +861,8 @@ def choose_modules_to_use(options, modules): logging.info('Skipping mod because %s - %s' % ( reason, ' '.join(disabled_mods))) + logging.info('Loading modules %s', ' '.join(sorted(to_load))) + return [modules[mod] for mod in to_load] """ diff --git a/doc/log.txt b/doc/log.txt index faba96814..a8627429c 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,5 +1,7 @@ * 1.8.7-pre, 2009-??-?? + - Fix processing multiple messages in XTS mode + - Add --no-autoload option to configure.py, for minimized builds * 1.8.6, 2009-08-13 - Add Cryptobox, a set of simple password-based encryption routines diff --git a/src/libstate/info.txt b/src/libstate/info.txt index 7ca35c5a4..6eaa2f70b 100644 --- a/src/libstate/info.txt +++ b/src/libstate/info.txt @@ -1,6 +1,6 @@ realname "Botan Libstate Module" -load_on auto +load_on always define LIBSTATE_MODULE diff --git a/src/libstate/pk_engine.h b/src/libstate/pk_engine.h index 3f8650a4e..256a47c20 100644 --- a/src/libstate/pk_engine.h +++ b/src/libstate/pk_engine.h @@ -9,6 +9,7 @@ #define BOTAN_ENGINE_PK_LOOKUP_H__ #include <botan/bigint.h> +#include <botan/pow_mod.h> #if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) #include <botan/if_op.h> diff --git a/src/utils/info.txt b/src/utils/info.txt index 95ea5fc2e..ab50b88ad 100644 --- a/src/utils/info.txt +++ b/src/utils/info.txt @@ -2,7 +2,7 @@ realname "Utility Functions" define UTIL_FUNCTIONS -load_on auto +load_on always <libs> tru64 -> rt
0
50
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
9d0ff797470697ec987150b54c251841bd04f366
Update the instructions for building the library.
commit 9d0ff797470697ec987150b54c251841bd04f366 Author: lloyd <[email protected]> Date: Thu Oct 5 20:23:28 2006 +0000 Update the instructions for building the library. diff --git a/doc/building.tex b/doc/building.tex index 392b92d5c..104121e64 100644 --- a/doc/building.tex +++ b/doc/building.tex @@ -33,13 +33,13 @@ \section{Introduction} -This document describes how to build Botan on Unix/POSIX and MS Windows -systems. The POSIX oriented descriptions should apply to most common Unix -systems today (including MacOS X), along with POSIX-ish systems like BeOS, QNX, -and Plan 9. Currently, systems other than Windows and POSIX (for example, VMS, -MacOS 9, and OS/390) are not supported by the build system, primarily due to -lack of access. Please contact the maintainer if you would like to build Botan -on such a system. +This document describes how to build Botan on Unix/POSIX and MS +Windows systems. The POSIX oriented descriptions should apply to most +common Unix systems (including MacOS X), along with POSIX-ish systems +like BeOS, QNX, and Plan 9. Currently, systems other than Windows and +POSIX (such as VMS, MacOS 9, OS/390, OS/400, ...) are not supported by +the build system, primarily due to lack of access. Please contact the +maintainer if you would like to build Botan on such a system. \section{For the Impatient} @@ -49,19 +49,26 @@ $ make $ make install \end{verbatim} -Or \verb|nmake|, if you're compiling on Windows with Visual C++. The -autoconfiguaration abilities of \filename{configure.pl} were only recently +Or using \verb|nmake|, if you're compiling on Windows with Visual +C++. On platforms that do not understand the '\#!' convention for +beginning script files, or that have Perl installed in an unusual +spot, you might need to prefix the \texttt{configure.pl} command with +\texttt{perl} or \texttt{/path/to/perl}. + +The autoconfiguaration abilities of \filename{configure.pl} were only recently added, so they may break if you run it on something unusual. In addition, you are certain to get more features, and possibly better optimization, by explicitly specifying how you want to library configured. How to do this is -detailed below. +detailed below. Also, if you don't want to use the default compiler (typically +either GNU C++ or Visual C++, depending on the platform), you will need to +specify one. \section{Building the Library} The first step is to run \filename{configure.pl}, which is a Perl script that creates various directories, config files, and a Makefile for building everything. It is run as \verb|./configure.pl CC-OS-CPU <extra args>|. The -script requires at least Perl 5.005, and preferably 5.6 or higher. +script requires at least Perl 5.6; any later version should also work. The tuple CC-OS-CPU specifies what system Botan is being built for, in terms of the C++ compiler, the operating system, and the CPU model. For example, to use @@ -71,25 +78,25 @@ GNU C++ on a FreeBSD box that has an Alpha EV6 CPU, one would use and \verb|CPU| that \filename{configure.pl} supports, run it with the ``\verb|--help|'' option. -You can put basically anything reasonable for CPU: the script knows about a -large number of different architectures, their sub-models, and common aliases -for them. The script does not display all the possibilities in it's help -message because there are simply too many entries (if you're curious about what -exactly is available, you can look at the \verb|%ARCH|, \verb|%ARCH_ALIAS|, and -\verb|%SUBMODEL_ALIAS| hashes at the start of the script). You should only -select the 64-bit version of a CPU (like ``sparc64'' or ``mips64'') if your -operating system knows how to handle 64-bit object code -- a 32-bit kernel on a -64-bit CPU will generally not like 64-bit code. For example, -gcc-solaris-sparc64 will not work unless you're running a 64-bit Solaris kernel -(for 32-bit Solaris running on an UltraSPARC system, you want -gcc-solaris-sparc32-v9). You may or may not have to install 64-bit versions of -libc and related system libraries as well. - -The script also knows about the various extension modules available. You can -enable one or more with the option ``\verb|--modules=MOD|'', where \verb|MOD| -is some name that identifies the extension (or a comma separated list of -them). Modules provide additional capabilities which require the use of non -portable APIs. +You can put basically anything reasonable for CPU: the script knows +about a large number of different architectures, their sub-models, and +common aliases for them. The script does not display all the +possibilities in its help message because there are simply too many +entries. You should only select the 64-bit version of a CPU (such as +``sparc64'' or ``mips64'') if your operating system knows how to +handle 64-bit object code -- a 32-bit kernel on a 64-bit CPU will +generally not like 64-bit code. For example, gcc-solaris-sparc64 will +not work unless you're running a 64-bit Solaris kernel (for 32-bit +Solaris running on an UltraSPARC system, you want +gcc-solaris-sparc32-v9). You may or may not have to install 64-bit +versions of libc and related system libraries as well. + +The script also knows about the various extension modules +available. You can enable one or more with the option +``\verb|--modules=MOD|'', where \verb|MOD| is some name that +identifies the extension (or a comma separated list of them). Modules +provide additional capabilities which require the use of APIs not +provided by ISO C/C++. Not all OSes or CPUs have specific support in \filename{configure.pl}. If the CPU architecture of your system isn't supported by \filename{configure.pl}, use @@ -97,22 +104,22 @@ CPU architecture of your system isn't supported by \filename{configure.pl}, use flags. Similarly, setting OS to 'generic' disables things which depend greatly on OS support (specifically, shared libraries). -However, it's impossible to guess which options to give to a system compiler. -Thus, if you want to compile Botan with a compiler which -\filename{configure.pl} does not support, the script will have to be updated. -Preferably, mail the man pages (or similar documentation) for the C and C++ -compilers and the system linker to the author, or download the Botan-config -package from the Botan web site, and do it yourself. Modifying -\filename{configure.pl} on it's own is useless aside from one-off hacks, -because the script is auto-generated by \emph{another} Perl script, which reads -a little mini-language that tells it all about the systems in question. - -The script tries to guess what kind of makefile to generate, and it almost -always guesses correctly (basically, Visual C++ uses NMAKE with Windows -commands, and everything else uses POSIX make with POSIX commands). Just in -case, you can override it with \verb|--make-style=somestyle|. The styles Botan -currently knows about are 'unix' (normal Unix makefiles), and 'nmake', the make -variant commonly used by Windows compilers. +However, it's impossible to guess which options to give to a system +compiler. Thus, if you want to compile Botan with a compiler which +\filename{configure.pl} does not support, you will need to tell it how +that compiler works. This is done by adding a new file in the +directory \filename{misc/config/cc}; the existing files should put you +in the right direction. + +The script tries to guess what kind of makefile to generate, and it +almost always guesses correctly (basically, Visual C++ uses NMAKE with +Windows commands, and everything else uses Unix make with POSIX +commands). Just in case, you can override it with +\verb|--make-style=somestyle|. The styles Botan currently knows about +are 'unix' (normal Unix makefiles), and 'nmake', the make variant +commonly used by Windows compilers. To add a new variant (eg, a build +script for VMS), you will need to create a new template file in +\filename{misc/config/makefile}. \pagebreak @@ -206,15 +213,15 @@ more extensions are available. All of them begin with \verb|BOTAN_EXT_|. For example, if \verb|BOTAN_EXT_COMPRESSOR_BZIP2| is defined, then an application using Botan can include \filename{<botan/bzip2.h>} and use the Bzip2 filters. -\macro{BOTAN\_MP\_WORD\_BITS}: This macro controls the size of the words used -for calculations with the MPI implementation in Botan. You can choose 8, 16, -32, or 64, with 32 being the default. You can use 8, 16, or 32 bit words on -any CPU, but the value should be set to the same size as the CPU's registers -for best performance. You can only use 64-bit words if the \module{mp\_asm64} -module is used; this offers vastly improved performance of public key -algorithms on certain 64-bit CPUs - this is set by default if the module is -used. Unless you are building for a 8 or 16-bit CPU, probably this isn't worth -messing with. +\macro{BOTAN\_MP\_WORD\_BITS}: This macro controls the size of the +words used for calculations with the MPI implementation in Botan. You +can choose 8, 16, 32, or 64, with 32 being the default. You can use 8, +16, or 32 bit words on any CPU, but the value should be set to the +same size as the CPU's registers for best performance. You can only +use 64-bit words if an assembly module (such as \module{mp\_ia32} or +\module{mp\_asm64}) is used. If the appropriate module is available, +64 bits are used, otherwise this is set to 32. Unless you are building +for a 8 or 16-bit CPU, this isn't worth messing with. \macro{BOTAN\_VECTOR\_OVER\_ALLOCATE}: The memory container \type{SecureVector} will over-allocate requests by this amount (in @@ -232,16 +239,25 @@ your machine. The default should be fine for most, if not all, purposes. compressing. The default is 255, which means 'Unknown'. You can look in RFC 1952 for the full list; the most common are Windows (0) and Unix (3). There is also a Macintosh (7), but it probably makes more sense to use the Unix code on -OS X. This is only used if the \texttt{comp\_zlib} module (which includes a -gzip compressor) is built. +OS X. + +\pagebreak + +\subsection{Multiple Builds} + +It may be useful to run multiple builds + +\subsection{Local Configuration} + + \pagebreak \section{Modules} -There are a fairly large number of modules included with Botan. Some of these -are extremely useful, while others are only necessary in very unusual -circumstances. The modules included with this release are: +There are a fairly large number of modules included with Botan. Some +of these are extremely useful, while others are only necessary in very +unusual circumstances. The modules included with this release are: \newcommand{\mod}[2]{\textbf{#1}: #2}
0
97
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
140a52d5857811f274363ee8c1a983374802db14
We would fail in the case where we connected to a server that did not support secure renegotiation, and then a renegotiation occured (either due to explicit request by a call to renegotiate, or if the counterparty send a hello request and our policy allowed insecure renegotiations), because supported() would be false but our client hello would still contain the renegotion extension. Instead, only break if the client hello doesn't support it but supported() == true, which indicates that at one point in the past both parties supported the extension.
commit 140a52d5857811f274363ee8c1a983374802db14 Author: lloyd <[email protected]> Date: Wed Jun 13 12:58:32 2012 +0000 We would fail in the case where we connected to a server that did not support secure renegotiation, and then a renegotiation occured (either due to explicit request by a call to renegotiate, or if the counterparty send a hello request and our policy allowed insecure renegotiations), because supported() would be false but our client hello would still contain the renegotion extension. Instead, only break if the client hello doesn't support it but supported() == true, which indicates that at one point in the past both parties supported the extension. diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp index 48f142fb5..3f3677105 100644 --- a/src/tls/tls_channel.cpp +++ b/src/tls/tls_channel.cpp @@ -270,7 +270,7 @@ void Channel::Secure_Renegotiation_State::update(Client_Hello* client_hello) } else { - if(supported() != client_hello->secure_renegotiation()) + if(supported() && !client_hello->secure_renegotiation()) throw TLS_Exception(Alert::HANDSHAKE_FAILURE, "Client changed its mind about secure renegotiation"); }
0
5
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
af07a773cc600d309a4b8cda0fd38006f0796f2d
Update readme.txt and changelog with 1.7.3 information
commit af07a773cc600d309a4b8cda0fd38006f0796f2d Author: lloyd <[email protected]> Date: Wed Jan 23 14:06:39 2008 +0000 Update readme.txt and changelog with 1.7.3 information diff --git a/doc/logs/log-17.txt b/doc/logs/log-17.txt index cab6dabbe..a09ab6617 100644 --- a/doc/logs/log-17.txt +++ b/doc/logs/log-17.txt @@ -1,10 +1,11 @@ -* 1.7.3, November 4, 2007 +* 1.7.3, January 23, 2008 - New invocation syntax for configure.pl with several new options - Support for IPv4 addresses in a subject alternative name - New fast poll for the generic Unix entropy source (es_unix) + - The es_file entropy source has been replaced by the es_dev module - The malloc allocator does not inherit from Pooling_Allocator anymore - - The dirs that es_unix will search in are now fully user-configurable + - The path that es_unix will search in are now fully user-configurable - Truncate X9.42 PRF output rather than allow counter overflow - PowerPC is now assumed to be big-endian diff --git a/readme.txt b/readme.txt index 882db47d6..facd46bd9 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ -Botan 1.7.3 (prerelease) +Botan 1.7.3 +http://botan.randombit.net/ Please note that this is an experimental / development version of -Botan. Don't be surprised by bugs. No, the documentation hasn't been -updated (yet). Feedback and critical analysis is highly -appreciated. If this sounds scary, it's recommended you use the latest -stable release (either 1.4.x or, preferably, 1.6.x). +Botan. Feedback and critical analysis is highly appreciated. There may +be bugs (as always). If this sounds scary, it's recommended you use +the latest stable (1.6) release. You can file bugs at http://www.randombit.net/bugzilla
0
26
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
f78a822ab2ff1172402a8628b01790a94a34b24d
Take sccache from upstream release instead of botan-ci-tools repo
commit f78a822ab2ff1172402a8628b01790a94a34b24d Author: Jack Lloyd <[email protected]> Date: Tue Aug 20 08:46:03 2019 -0400 Take sccache from upstream release instead of botan-ci-tools repo diff --git a/doc/dev_ref/continuous_integration.rst b/doc/dev_ref/continuous_integration.rst index a76f12330..d8e363108 100644 --- a/doc/dev_ref/continuous_integration.rst +++ b/doc/dev_ref/continuous_integration.rst @@ -5,8 +5,8 @@ CI Build Script ---------------- The Travis and AppVeyor builds are orchestrated using a script -``src/scripts/ci_build.py``. This allows one to easily reproduce the -build steps of CI on a local machine. +``src/scripts/ci_build.py``. This allows one to easily reproduce the CI process +on a local machine. A seperate repo https://github.com/randombit/botan-ci-tools holds binaries which are used by the CI. @@ -18,8 +18,8 @@ https://travis-ci.org/randombit/botan This is the primary CI, and tests the Linux, macOS, and iOS builds. Among other things it runs tests using valgrind, cross compilation to different -architectures (currently ARM, PowerPC and MIPS), MinGW build, and the a build -that produces the coverage report. +architectures (currently ARM, PowerPC and MIPS), MinGW build, and a build that +produces the coverage report. The Travis configurations is in ``src/scripts/ci/travis.yml``, which executes a setup script ``src/scripts/ci/setup_travis.sh`` to install needed packages. @@ -34,9 +34,9 @@ Runs a build/test cycle using MSVC on Windows. Like Travis it uses ``src/scripts/ci_build.py``. The AppVeyor setup script is in ``src/scripts/ci/setup_appveyor.bat`` -The AppVeyor build uses ``sccache`` as a compiler cache. Since that is not -available in the AppVeyor images it takes a precompiled copy checked into the -``botan-ci-tools`` repo. +The AppVeyor build uses `sccache <https://github.com/mozilla/sccache>`_ as a +compiler cache. Since that is not available in the AppVeyor images, the setup +script downloads a release binary from the upstream repository. LGTM --------- @@ -44,7 +44,8 @@ LGTM https://lgtm.com/projects/g/randombit/botan/ An automated linter that is integrated with Github. It automatically checks each -incoming PR. It also supports custom queries/alerts, which likely would be useful. +incoming PR. It also supports custom queries/alerts, which likely would be worth +investigating but is not something currently in use. Coverity --------- @@ -74,4 +75,4 @@ https://github.com/google/oss-fuzz/ OSS-Fuzz is a distributed fuzzer run by Google. Every night, each library fuzzer in ``src/fuzzer`` is built and run on many machines with any findings reported -by email. +to the developers by email. diff --git a/src/scripts/ci/appveyor.yml b/src/scripts/ci/appveyor.yml index bc9a65d08..6174fc0e6 100644 --- a/src/scripts/ci/appveyor.yml +++ b/src/scripts/ci/appveyor.yml @@ -5,6 +5,7 @@ environment: SCCACHE_DIR: C:\Users\appveyor\AppData\Local\Mozilla\sccache\cache SCCACHE_CACHE_SIZE: 128M + SCCACHE_VERSION: 0.2.10 APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -m0=lzma -mx=9 matrix: diff --git a/src/scripts/ci/setup_appveyor.bat b/src/scripts/ci/setup_appveyor.bat index 02638f06a..b6a822468 100644 --- a/src/scripts/ci/setup_appveyor.bat +++ b/src/scripts/ci/setup_appveyor.bat @@ -8,7 +8,8 @@ if %MSVS% == 2019 call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview rem check compiler version cl -git clone --depth 1 https://github.com/randombit/botan-ci-tools +appveyor DownloadFile https://github.com/mozilla/sccache/releases/download/%SCCACHE_VERSION%/sccache-%SCCACHE_VERSION%-x86_64-pc-windows-msvc.tar.gz +tar -xf sccache-%SCCACHE_VERSION%-x86_64-pc-windows-msvc.tar.gz -rem include QtCreator bin dir to get jom -set PATH=C:\Qt\Tools\QtCreator\bin;%PATH%;botan-ci-tools +REM include QtCreator bin dir to get jom +set PATH=%PATH%;C:\Qt\Tools\QtCreator\bin;sccache-%SCCACHE_VERSION%-x86_64-pc-windows-msvc
0
52
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a38d045acf208390b04c03f6473783e71be93168
Tick version to 1.11.23 [ci skip]
commit a38d045acf208390b04c03f6473783e71be93168 Author: Jack Lloyd <[email protected]> Date: Tue Oct 27 10:10:53 2015 -0400 Tick version to 1.11.23 [ci skip] diff --git a/botan_version.py b/botan_version.py index 5f2d8bae4..a99c6fc51 100644 --- a/botan_version.py +++ b/botan_version.py @@ -1,7 +1,7 @@ release_major = 1 release_minor = 11 -release_patch = 23 +release_patch = 24 release_so_abi_rev = release_patch # These are set by the distribution script diff --git a/doc/news.rst b/doc/news.rst index eb9efec9f..7d53f9d24 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -1,6 +1,13 @@ Release Notes ======================================== +Version 1.11.24, Not Yet Released +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Fixed an endian dependency in McEliece key generation which caused + keys to be generated differently on big and little endian systems, + even when using a deterministic PRNG with the same seed. + Version 1.11.23, 2015-10-26 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0
15
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
2817c0afc87b85056edc362c933c3eb3a0799350
Update comments in FFI header Add/fix Doxygen comments. Remove warning which is not really true anymore.
commit 2817c0afc87b85056edc362c933c3eb3a0799350 Author: Jack Lloyd <[email protected]> Date: Wed Aug 15 08:22:47 2018 -0400 Update comments in FFI header Add/fix Doxygen comments. Remove warning which is not really true anymore. diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index 58d446d55..54c01174c 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -13,9 +13,9 @@ extern "C" { #endif /* -This header exports some of botan's functionality via a C89 -interface. This API is uesd by the Python and OCaml bindings via those -languages respective ctypes libraries. +This header exports some of botan's functionality via a C89 interface. This API +is uesd by the Python, OCaml, Rust and Ruby bindings via those languages +respective ctypes/FFI libraries. The API is intended to be as easy as possible to call from other languages, which often have easy ways to call C, because C. But some C @@ -33,7 +33,7 @@ API follows a few simple rules: - No ownership of memory transfers across the API boundary. The API will consume data from const pointers, and will produce output by writing to - variables provided by the caller. + buffers provided by (and allocated by) the caller. - If exporting a value (a string or a blob) the function takes a pointer to the output array and a read/write pointer to the length. If the length is insufficient, an @@ -43,18 +43,9 @@ API follows a few simple rules: which is not idempotent and are documented specially. But it's a general theory of operation. -The API is not currently documented, nor should it be considered -stable. It is buggy as heck, most likely, and error handling is a -mess. However the goal is to provide a long term API usable for -language bindings, or for use by systems written in C. Suggestions on -how to provide the cleanest API for such users would be most welcome. - -* TODO: -* - Better error reporting -* - User callback for exception logging? -* - Doxygen comments for all functions/params -* - X.509 certs and PKIX path validation goo -* - TLS + TODO: + - Doxygen comments for all functions/params + - TLS */ #include <botan/build.h> @@ -190,8 +181,6 @@ typedef struct botan_rng_struct* botan_rng_t; * @param rng_type type of the rng, possible values: * "system": System_RNG, "user": AutoSeeded_RNG * Set rng_type to null or empty string to let the library choose -* -* TODO: replace rng_type with simple flags? */ BOTAN_PUBLIC_API(2,0) int botan_rng_init(botan_rng_t* rng, const char* rng_type); @@ -201,8 +190,6 @@ BOTAN_PUBLIC_API(2,0) int botan_rng_init(botan_rng_t* rng, const char* rng_type) * @param out output buffer of size out_len * @param out_len number of requested bytes * @return 0 on success, negative on failure -* -* TODO: better name */ BOTAN_PUBLIC_API(2,0) int botan_rng_get(botan_rng_t rng, uint8_t* out, size_t out_len); @@ -218,9 +205,9 @@ BOTAN_PUBLIC_API(2,0) int botan_rng_reseed(botan_rng_t rng, size_t bits); /** * Reseed a random number generator -* Uses the System_RNG as a seed generator. * * @param rng rng object +* @param source_rng the rng that will be read from * @param bits number of bits to to reseed with * @return 0 on success, a negative value on failure */ @@ -258,9 +245,6 @@ typedef struct botan_hash_struct* botan_hash_t; * @param hash_name name of the hash function, e.g., "SHA-384" * @param flags should be 0 in current API revision, all other uses are reserved * and return BOTAN_FFI_ERROR_BAD_FLAG -* -* TODO: since output_length is effectively required to use this API, -* return it from init as an output parameter */ BOTAN_PUBLIC_API(2,0) int botan_hash_init(botan_hash_t* hash, const char* hash_name, uint32_t flags); @@ -425,38 +409,80 @@ typedef struct botan_cipher_struct* botan_cipher_t; #define BOTAN_CIPHER_INIT_FLAG_ENCRYPT 0 #define BOTAN_CIPHER_INIT_FLAG_DECRYPT 1 +/** +* Initialize a cipher object +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_init(botan_cipher_t* cipher, const char* name, uint32_t flags); +/** +* Return the name of the cipher object +*/ BOTAN_PUBLIC_API(2,8) int botan_cipher_name(botan_cipher_t cipher, char* name, size_t* name_len); +/** +* Return the output length of this cipher, for a particular input length. +*/ BOTAN_PUBLIC_API(2,8) int botan_cipher_output_length(botan_cipher_t cipher, size_t in_len, size_t* out_len); +/** +* Return if the specified nonce length is valid for this cipher +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl); + +/** +* Get the tag length of the cipher (0 for non-AEAD modes) +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t* tag_size); + +/** +* Get the default nonce length of this cipher +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t* nl); + +/** +* Return the update granularity of the cipher; botan_cipher_update must be +* called with blocks of this size, except for the final. +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_get_update_granularity(botan_cipher_t cipher, size_t* ug); -// Prefer botan_cipher_get_keyspec +/** +* Get information about the key lengths. Prefer botan_cipher_get_keyspec +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_query_keylen(botan_cipher_t, size_t* out_minimum_keylength, size_t* out_maximum_keylength); +/** +* Get information about the supported key lengths. +*/ BOTAN_PUBLIC_API(2,8) int botan_cipher_get_keyspec(botan_cipher_t, size_t* min_keylen, size_t* max_keylen, size_t* mod_keylen); +/** +* Set the key for this cipher object +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_set_key(botan_cipher_t cipher, - const uint8_t* key, size_t key_len); + const uint8_t* key, size_t key_len); +/** +* Set the associated data. Will fail if cipher is not an AEAD +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_set_associated_data(botan_cipher_t cipher, const uint8_t* ad, size_t ad_len); +/** +* Begin processing a new message using the provided nonce +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_start(botan_cipher_t cipher, const uint8_t* nonce, size_t nonce_len); #define BOTAN_CIPHER_UPDATE_FLAG_FINAL (1U << 0) +/** +* Encrypt some data +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_update(botan_cipher_t cipher, uint32_t flags, uint8_t output[], @@ -466,7 +492,14 @@ BOTAN_PUBLIC_API(2,0) int botan_cipher_update(botan_cipher_t cipher, size_t input_size, size_t* input_consumed); +/** +* Reset the key, nonce, AD and all other state on this cipher object +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_clear(botan_cipher_t hash); + +/** +* Destroy the cipher object +*/ BOTAN_PUBLIC_API(2,0) int botan_cipher_destroy(botan_cipher_t cipher); /* @@ -567,11 +600,17 @@ BOTAN_PUBLIC_API(2,1) int botan_block_cipher_set_key(botan_block_cipher_t bc, */ BOTAN_PUBLIC_API(2,1) int botan_block_cipher_block_size(botan_block_cipher_t bc); +/** +* Encrypt one or more blocks with the cipher +*/ BOTAN_PUBLIC_API(2,1) int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks); +/** +* Decrypt one or more blocks with the cipher +*/ BOTAN_PUBLIC_API(2,1) int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], @@ -600,31 +639,79 @@ BOTAN_PUBLIC_API(2,8) int botan_block_cipher_get_keyspec(botan_block_cipher_t ci size_t* out_keylength_modulo); /* -* Multiple precision integers +* Multiple precision integers (MPI) */ typedef struct botan_mp_struct* botan_mp_t; +/** +* Initialize an MPI +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_init(botan_mp_t* mp); + +/** +* Destroy (deallocate) an MPI +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_destroy(botan_mp_t mp); -// writes botan_mp_num_bytes(mp)*2 + 1 bytes to out[] +/** +* Convert the MPI to a hex string. Writes botan_mp_num_bytes(mp)*2 + 1 bytes +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_to_hex(const botan_mp_t mp, char* out); + +/** +* Convert the MPI to a string. Currently base == 10 and base == 16 are supported. +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_to_str(const botan_mp_t mp, uint8_t base, char* out, size_t* out_len); +/** +* Set the MPI to zero +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_clear(botan_mp_t mp); +/** +* Set the MPI value from an int +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_set_from_int(botan_mp_t mp, int initial_value); + +/** +* Set the MPI value from another MP object +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_set_from_mp(botan_mp_t dest, const botan_mp_t source); + +/** +* Set the MPI value from a string +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_set_from_str(botan_mp_t dest, const char* str); + +/** +* Set the MPI value from a string with arbitrary radix. +* For arbitrary being 10 or 16. +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_set_from_radix_str(botan_mp_t dest, const char* str, size_t radix); +/** +* Return the number of significant bits in the MPI +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_num_bits(const botan_mp_t n, size_t* bits); + +/** +* Return the number of significant bytes in the MPI +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_num_bytes(const botan_mp_t n, size_t* bytes); -// Writes botan_mp_num_bytes(mp) to vec +/* +* Convert the MPI to a big-endian binary string. Writes botan_mp_num_bytes to vec +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_to_bin(const botan_mp_t mp, uint8_t vec[]); + +/* +* Set an MP to the big-endian binary value +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t vec_len); +/* +* Convert the MPI to a uint32_t, if possible. Fails if MPI is negative or too large. +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_to_uint32(const botan_mp_t mp, uint32_t* val); /** @@ -654,11 +741,11 @@ BOTAN_PUBLIC_API(2,1) int botan_mp_sub(botan_mp_t result, const botan_mp_t x, co BOTAN_PUBLIC_API(2,1) int botan_mp_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y); BOTAN_PUBLIC_API(2,1) int botan_mp_div(botan_mp_t quotient, - botan_mp_t remainder, - const botan_mp_t x, const botan_mp_t y); + botan_mp_t remainder, + const botan_mp_t x, const botan_mp_t y); BOTAN_PUBLIC_API(2,1) int botan_mp_mod_mul(botan_mp_t result, const botan_mp_t x, - const botan_mp_t y, const botan_mp_t mod); + const botan_mp_t y, const botan_mp_t mod); /* * Returns 0 if x != y @@ -754,6 +841,14 @@ BOTAN_PUBLIC_API(2,0) int botan_bcrypt_is_valid(const char* pass, const char* ha */ typedef struct botan_privkey_struct* botan_privkey_t; +/** +* Create a new private key +* @param key the new object will be placed here +* @param algo_name something like "RSA" or "ECDSA" +* @param algo_params is specific to the algorithm. For RSA, specifies +* the modulus bit length. For ECC is the name of the curve. +* @param rng a random number generator +*/ BOTAN_PUBLIC_API(2,0) int botan_privkey_create(botan_privkey_t* key, const char* algo_name, const char* algo_params, @@ -770,7 +865,7 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_create_mceliece(botan_privkey_t* key, bo BOTAN_PUBLIC_API(2,0) int botan_privkey_create_dh(botan_privkey_t* key, botan_rng_t rng, const char* param); -/* +/** * Generates DSA key pair. Gives to a caller control over key length * and order of a subgroup 'q'. * @@ -787,14 +882,14 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_create_dh(botan_privkey_t* key, botan_rn * `qbits' * @returns BOTAN_FFI_ERROR_NOT_IMPLEMENTED functionality not implemented * --------------------------------------------------------------------------------- */ +*/ BOTAN_PUBLIC_API(2,5) int botan_privkey_create_dsa( botan_privkey_t* key, botan_rng_t rng, size_t pbits, size_t qbits); -/* +/** * Generates ElGamal key pair. Caller has a control over key length * and order of a subgroup 'q'. Function is able to use two types of * primes: @@ -812,14 +907,14 @@ BOTAN_PUBLIC_API(2,5) int botan_privkey_create_dsa( * `qbits' * @returns BOTAN_FFI_ERROR_NOT_IMPLEMENTED functionality not implemented * --------------------------------------------------------------------------------- */ +*/ BOTAN_PUBLIC_API(2,5) int botan_privkey_create_elgamal( botan_privkey_t* key, botan_rng_t rng, size_t pbits, size_t qbits); -/* +/** * Input currently assumed to be PKCS #8 structure; * Set password to NULL to indicate no encryption expected * Starting in 2.8.0, the rng parameter is unused and may be set to null @@ -834,7 +929,7 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_destroy(botan_privkey_t key); #define BOTAN_PRIVKEY_EXPORT_FLAG_DER 0 #define BOTAN_PRIVKEY_EXPORT_FLAG_PEM 1 -/* +/** * On input *out_len is number of bytes in out[] * On output *out_len is number of bytes written (or required) * If out is not big enough no output is written, *out_len is set and 1 is returned @@ -847,7 +942,7 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_export(botan_privkey_t key, BOTAN_PUBLIC_API(2,8) int botan_privkey_algo_name(botan_privkey_t key, char out[], size_t* out_len); -/* +/** * Set encryption_algo to NULL or "" to have the library choose a default (recommended) */ BOTAN_DEPRECATED("Use botan_privkey_export_encrypted_pbkdf_{msec,iter}") @@ -872,7 +967,7 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted_pbkdf_msec(botan_privke const char* pbkdf_algo, uint32_t flags); -/* +/** * Export a private key using the specified number of iterations. */ BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key, @@ -985,7 +1080,7 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_load_dh(botan_privkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t x); -/* +/** * Loads Diffie Hellman public key * * @param key variable populated with key material @@ -1007,7 +1102,7 @@ BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_dh(botan_pubkey_t* key, * Algorithm specific key operations: ElGamal */ -/* +/** * Loads ElGamal public key * @param key variable populated with key material * @param p prime order of a Z_p group @@ -1024,7 +1119,7 @@ BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_elgamal(botan_pubkey_t* key, botan_mp_t g, botan_mp_t y); -/* +/** * Loads ElGamal private key * * @param key variable populated with key material
0
82
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
9ea54fcb8b9172ce9a756a2ef1ade7138f7d6a34
Add first change notes about the upcoming 1.7.6
commit 9ea54fcb8b9172ce9a756a2ef1ade7138f7d6a34 Author: lloyd <[email protected]> Date: Thu Apr 17 15:50:39 2008 +0000 Add first change notes about the upcoming 1.7.6 diff --git a/doc/log.txt b/doc/log.txt index a8ed6bb7a..7f7225410 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,4 +1,8 @@ +* 1.7.6 + - Initial support for Windows DLLs + - Removed the AEP module, due to inability to test + * 1.7.5, April 12, 2008 - The API of X509_CA::sign_request was altered to avoid race conditions - New type Pipe::message_id to represent the Pipe message number diff --git a/readme.txt b/readme.txt index 195a3475a..1430e97d9 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -Botan 1.7.5 +Botan 1.7.6 (prerelease) http://botan.randombit.net/ Please note that this is an experimental / development version of
0
72
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
7f91d977e718a07ee8a40c325fa70d6baf319ea9
Minor update to goals text
commit 7f91d977e718a07ee8a40c325fa70d6baf319ea9 Author: Jack Lloyd <[email protected]> Date: Fri Sep 28 12:22:44 2018 -0400 Minor update to goals text diff --git a/doc/manual/goals.rst b/doc/manual/goals.rst index cf5522904..840e1bd81 100644 --- a/doc/manual/goals.rst +++ b/doc/manual/goals.rst @@ -60,14 +60,15 @@ the desired end result. Over time further progress is made in each. * Portability to modern systems. Botan does not run everywhere, and we actually do not want it to (see non-goals below). But we do want it to run on anything - that someone is deploying new applications on. That includes both major OSes - like Windows, Linux, and BSD and also relatively new OSes such as IncludeOS. + that someone is deploying new applications on. That includes both major + platforms like Windows, Linux, Android and iOS, and also promising new systems + such as IncludeOS and Fuchsia. * Well documented. Ideally every public API would have some place in the manual describing its usage. * Useful command line utility. The botan command line tool should be flexible - and featured enough to replace similar tools such as openssl for everyday + and featured enough to replace similar tools such as ``openssl`` for everyday users. Non-Goals @@ -84,10 +85,9 @@ seek to address. * Implementing every crypto scheme in existence. The focus is on algorithms which are in practical use in systems deployed now, as well as promising - algorithms for future deployment. Many algorithms which were of interest 5-15 - years ago but which never saw widespread deployment and have no compelling - benefit over other designs were originally implemented in the library but have - since been removed to simplify the codebase. + algorithms for future deployment. Many algorithms which were of interest + in the past but never saw widespread deployment and have no compelling + benefit over other designs have been removed to simplify the codebase. * Portable to obsolete systems. There is no reason for crypto software to support ancient OS platforms like SunOS or Windows 2000, since these unpatched @@ -96,23 +96,23 @@ seek to address. * Portable to every C++ compiler ever made. Over time Botan moves forward to both take advantage of new language/compiler features, and to shed workarounds - for dealing with bugs in ancient compilers. The set of supported compilers is - fixed for each new release branch, for example Botan 2.x will always support - GCC 4.8. But a future 3.x release version will likely increase the required - versions for all compilers. + for dealing with bugs in ancient compilers, allowing further simplifications + in the codebase. The set of supported compilers is fixed for each new release + branch, for example Botan 2.x will always support GCC 4.8. But a future 3.x + release version will likely increase the required versions for all compilers. * FIPS 140 validation. The primary developer was (long ago) a consultant with a NIST approved testing lab. He does not have a positive view of the process or - results, at least when it comes to Level 1 software validations (a Level 4 - validation is however the real deal). The only benefit of a Level 1 validation - is to allow for government sales, and the cost of validation includes enormous - amounts of time and money, adding 'checks' that are useless or actively - harmful, then freezing the software version so security updates cannot be - applied in the future. It does force a certain minimum standard (ie, FIPS - Level 1 does assure AES and RSA are probably implemented correctly) but this - is an issue of interop not security since Level 1 does not seriously consider - attacks of any kind. Any security budget would be far better spent on a review - from a specialized crypto consultancy, who would look for actual flaws. + results, particularly when it comes to Level 1 software validations. The only + benefit of a Level 1 validation is to allow for government sales, and the cost + of validation includes enormous amounts of time and money, adding 'checks' + that are useless or actively harmful, then freezing the software so security + updates cannot be applied in the future. It does force a certain minimum + standard (ie, FIPS Level 1 does assure AES and RSA are probably implemented + correctly) but this is an issue of interop not security since Level 1 does not + seriously consider attacks of any kind. Any security budget would be far + better spent on a review from a specialized crypto consultancy, who would look + for actual flaws. That said it would be easy to add a "FIPS 140" build mode to Botan, which just disabled all the builtin crypto and wrapped whatever the most recent OpenSSL
0
87
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
ed71932346613c533495369efa6a2b0668efac6f
Document what we do in GCM a bit better [ci skip]
commit ed71932346613c533495369efa6a2b0668efac6f Author: Jack Lloyd <[email protected]> Date: Thu Jun 21 20:22:59 2018 -0400 Document what we do in GCM a bit better [ci skip] diff --git a/doc/manual/side_channels.rst b/doc/manual/side_channels.rst index 459b21396..fa9861603 100644 --- a/doc/manual/side_channels.rst +++ b/doc/manual/side_channels.rst @@ -264,8 +264,11 @@ GCM On platforms that support a carryless multiply instruction (ARMv8 and recent x86), GCM is fast and constant time. -On all other platforms, GCM uses a slow but constant time algorithm. There is -also an SSSE3 variant of the same (still relatively slow) algorithm. +On all other platforms, GCM uses an algorithm based on precomputing all powers +of H from 1 to 128. Then for every bit of the input a mask is formed which +allows conditionally adding that power without leaking information via a cache +side channel. There is also an SSSE3 variant of this algorithm which is somewhat +faster on processors which have SSSE3 but no AES-NI instructions. OCB -----------------------
0
58
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
d7d0b4bf346a9cb383ad42c61a599140a4d8a269
Update news
commit d7d0b4bf346a9cb383ad42c61a599140a4d8a269 Author: Jack Lloyd <[email protected]> Date: Fri Dec 1 13:13:43 2017 -0500 Update news diff --git a/news.rst b/news.rst index e8abd5669..371440570 100644 --- a/news.rst +++ b/news.rst @@ -4,6 +4,12 @@ Release Notes Version 2.4.0, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* Several build improvements requested by downstream packagers, including the + ability to disable building the static library. All makefile constructs that + were specific to nmake or GNU make have been eliminated, thus the option + ``--makefile-style`` which was previously used to select the makefile type has + also been removed. (GH #1230 #1237 #1300 #1318 #1319 #1324 and #1325) + * Support for negotiating the DH group as specified in RFC 7919 is now available in TLS (GH #1263)
0
59
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
1b9d13aed71152d61fab7e0ba016d1951909bac5
Fix ReST formatting [ci skip]
commit 1b9d13aed71152d61fab7e0ba016d1951909bac5 Author: Jack Lloyd <[email protected]> Date: Wed Oct 26 09:49:28 2016 -0400 Fix ReST formatting [ci skip] diff --git a/doc/news.rst b/doc/news.rst index bea9da684..58b84bc5d 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -62,7 +62,7 @@ Version 1.11.33, 2016-10-26 files with ABI specific flags such as ``-maes``. (GH #665) * Internal cleanups to TLS CBC record handling. TLS CBC ciphersuites - can now be disabled by disabling `tls_cbc` module. (GH #642 #659) + can now be disabled by disabling ``tls_cbc`` module. (GH #642 #659) * Internal cleanups to the object lookup code eliminates most global locks and all use of static initializers (GH #668 #465) diff --git a/doc/security.rst b/doc/security.rst index 1c0aea69f..96ce0698d 100644 --- a/doc/security.rst +++ b/doc/security.rst @@ -10,7 +10,7 @@ mail please use:: Key fingerprint = 4E60 C735 51AF 2188 DF0A 5A62 78E9 8043 5712 3B60 uid Jack Lloyd <[email protected]> -This key can be found in the file `pgpkey.txt` or online at +This key can be found in the file ``pgpkey.txt`` or online at https://keybase.io/jacklloyd and on most PGP keyservers. Advisories
0
18
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
567a768bc860b885b2c4ee7417940e2e194e9dc5
More FFI docs [ci skip]
commit 567a768bc860b885b2c4ee7417940e2e194e9dc5 Author: Jack Lloyd <[email protected]> Date: Tue Aug 14 17:43:00 2018 -0400 More FFI docs [ci skip] diff --git a/doc/manual/ffi.rst b/doc/manual/ffi.rst index 3061b8ddd..f63377496 100644 --- a/doc/manual/ffi.rst +++ b/doc/manual/ffi.rst @@ -881,7 +881,7 @@ Public Key Encryption/Decryption uint8_t out[], size_t* out_len, \ uint8_t ciphertext[], size_t ciphertext_len) -Signatures +Signature Generation ---------------------------------------- .. cpp:type:: opaque* botan_pk_op_sign_t @@ -893,18 +893,34 @@ Signatures const char* hash_and_padding, \ uint32_t flags) + Create a signature operator for the provided key. The padding string + specifies what hash function and padding should be used, for example + "PKCS1v15(SHA-256)" or "EMSA1(SHA-384)". + .. cpp:function:: int botan_pk_op_sign_destroy(botan_pk_op_sign_t op) + Destroy an object created by :cpp:func:`botan_pk_op_sign_create`. + .. cpp:function:: int botan_pk_op_sign_output_length(botan_pk_op_sign_t op, size_t* sig_len) - Writes the length of the + Writes the length of the signatures that this signer will produce. This + allows properly sizing the buffer passed to + :cpp:func:`botan_pk_op_sign_finish`. .. cpp:function:: int botan_pk_op_sign_update(botan_pk_op_sign_t op, \ const uint8_t in[], size_t in_len) + Add bytes of the message to be signed. + .. cpp:function:: int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng, \ uint8_t sig[], size_t* sig_len) + Produce a signature over all of the bytes passed to :cpp:func:`botan_pk_op_sign_update`. + Afterwards, the sign operator is reset and may be used to sign a new message. + +Signature Verification +---------------------------------------- + .. cpp:type:: opaque* botan_pk_op_verify_t An opaque data type for a signature verification operation. Don't mess with it. @@ -919,9 +935,14 @@ Signatures .. cpp:function:: int botan_pk_op_verify_update(botan_pk_op_verify_t op, \ const uint8_t in[], size_t in_len) + Add bytes of the message to be verified + .. cpp:function:: int botan_pk_op_verify_finish(botan_pk_op_verify_t op, \ const uint8_t sig[], size_t sig_len) + Verify if the signature provided matches with the message provided as calls + to :cpp:func:`botan_pk_op_verify_update`. + Key Agreement ----------------------------------------
0
62
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
06fdd2660f75ab76348ff254ccd945acec8664ed
Bump version to 2.8.0-pre
commit 06fdd2660f75ab76348ff254ccd945acec8664ed Author: Jack Lloyd <[email protected]> Date: Fri Jul 6 11:05:51 2018 -0400 Bump version to 2.8.0-pre diff --git a/news.rst b/news.rst index 376a6d622..b9c582764 100644 --- a/news.rst +++ b/news.rst @@ -1,6 +1,17 @@ Release Notes ======================================== +Version 2.8.0, Not Yet Released +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Avoid a cache side channel in the AES key schedule + +* Add functions to load and save RSA keys in PKCS #1 format to FFI (GH #1621) + +* Add ``pk_encrypt`` and ``pk_decrypt`` CLI operations + +* Now ``asn1print`` CLI defaults to printing context-specific fields. + Version 2.7.0, 2018-07-02 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/build-data/version.txt b/src/build-data/version.txt index dd9d59e34..9c5d809cb 100644 --- a/src/build-data/version.txt +++ b/src/build-data/version.txt @@ -1,6 +1,6 @@ release_major = 2 -release_minor = 7 +release_minor = 8 release_patch = 0 release_so_abi_rev = 7
0
19
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
021203aa782f3aa514dd9f3e4f129c06692d37e2
Transformation_Filter calls send() inside of start_msg() which means that any filters which follow in the pipe will get write() called on them before start_msg(), causing confusion and/or crashes. This patch fixes it for the case when start() returns an empty vector which covers all current use cases. I'll have to figure out another approach for the general case (or decide the general case isn't worth supporting and remove the return value from start).
commit 021203aa782f3aa514dd9f3e4f129c06692d37e2 Author: lloyd <[email protected]> Date: Mon Feb 17 15:26:00 2014 +0000 Transformation_Filter calls send() inside of start_msg() which means that any filters which follow in the pipe will get write() called on them before start_msg(), causing confusion and/or crashes. This patch fixes it for the case when start() returns an empty vector which covers all current use cases. I'll have to figure out another approach for the general case (or decide the general case isn't worth supporting and remove the return value from start). diff --git a/doc/relnotes/1_11_9.rst b/doc/relnotes/1_11_9.rst index aae4e660f..6ee0b4baf 100644 --- a/doc/relnotes/1_11_9.rst +++ b/doc/relnotes/1_11_9.rst @@ -3,3 +3,7 @@ Version 1.11.9, Not Yet Released * Fix a bug in certificate path validation which prevented successful validation if intermediate certificates were presented out of order. + + * Fix a bug introduced in 1.11.5 which could cause crashes or other + incorrect behavior when a cipher mode filter was followed in the + pipe by another filter, and that filter had a non-empty start_msg. diff --git a/src/lib/filters/filter.cpp b/src/lib/filters/filter.cpp index 3eb924172..de678f537 100644 --- a/src/lib/filters/filter.cpp +++ b/src/lib/filters/filter.cpp @@ -27,6 +27,9 @@ Filter::Filter() */ void Filter::send(const byte input[], size_t length) { + if(!length) + return; + bool nothing_attached = true; for(size_t j = 0; j != total_ports(); ++j) if(next[j])
0
4
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
eb72e95f5365827345763abcd1f7dc052af04366
Update side channel docs [ci skip]
commit eb72e95f5365827345763abcd1f7dc052af04366 Author: Jack Lloyd <[email protected]> Date: Sun Feb 2 07:08:03 2025 -0500 Update side channel docs [ci skip] diff --git a/doc/side_channels.rst b/doc/side_channels.rst index 2243a4475..3778e80b0 100644 --- a/doc/side_channels.rst +++ b/doc/side_channels.rst @@ -70,15 +70,20 @@ to calculate the CRT parameters. The GCD computation, LCM computations, modulo, and inversion of ``q`` modulo ``p`` are all done via constant time algorithms. An additional inversion, of ``e`` modulo ``phi(n)``, is also required. This one is somewhat more complicated because ``phi(n)`` is even and the primary constant -time algorithm for inversions only works for odd moduli. This is worked around -by a technique based on the CRT - ``phi(n)`` is factored to ``2**e * z`` for -some ``e`` > 1 and some odd ``z``. Then ``e`` is inverted modulo ``2**e`` and -also modulo ``z``. The inversion modulo ``2**e`` is done via a specialized -constant-time algoirthm which only works for powers of 2. Then the two -inversions are combined using the CRT. This process does leak the value of -``e``; to avoid problems ``p`` and ``q`` are chosen so that ``e`` is always 1. +time algorithm for inversions only works for odd moduli. -See blinding.cpp and rsa.cpp. +When ``e`` is equal to 65537, we use Arazi's inversion algorithm [GcdFree] +which is fast and quite simple to run in constant time. + +For general ``e``, the inversion proceeds using a technique based on the CRT - +``phi(n)`` is factored to ``2**k * o`` for some ``k`` > 1 and some odd +``o``. Then ``e`` is inverted modulo ``2**k`` and also modulo ``o``. The +inversion modulo ``2**k`` is done via a specialized constant-time algoirthm +which only works for powers of 2. Then the two inversions are combined using the +CRT. This process does leak the value of ``k``; when generating keys Botan +chooses ``p`` and ``q`` so that ``k`` is always 1. + +See blinding.cpp, rsa.cpp, and mod_inv.cpp Decryption of PKCS #1 v1.5 Ciphertexts ---------------------------------------- @@ -217,6 +222,9 @@ based side channels. It does make use of integer multiplications; on some old CPUs these multiplications take variable time and might allow a side channel attack. This is not considered a problem on modern processors. +The x25519 implementation does not currently include blinding or point +rerandomization. + TLS CBC ciphersuites ---------------------- @@ -372,8 +380,8 @@ block of memory is allocated and locked, then the memory is scrubbed before freeing. This memory pool is used by secure_vector when available. It can be disabled at runtime setting the environment variable BOTAN_MLOCK_POOL_SIZE to 0. -Automated Analysis ---------------------- +Side Channel Analysis Tools +----------------------------- Currently the main tool used by the Botan developers for testing for side channels at runtime is valgrind; valgrind's runtime API is used to taint memory @@ -381,6 +389,8 @@ values, and any jumps or indexes using data derived from these values will cause a valgrind warning. This technique was first used by Adam Langley in ctgrind. See header ct_utils.h. +There is a self-test of the constant time annotations in ``src/ct_selftest``. + To check, install valgrind, configure the build with --with-valgrind, and run the tests. @@ -392,10 +402,10 @@ detect simple timing differences. The output can be processed using the Mona timing report library (https://github.com/seecurity/mona-timing-report). To run a timing report (here for example pow_mod):: - $ ./botan timing_test pow_mod > pow_mod.raw + $ botan timing_test pow_mod > pow_mod.raw -This must be run from a checkout of the source, or otherwise ``--test-data-dir=`` -must be used to point to the expected input files. +This must be run from a checkout of the source, or otherwise the option +``--test-data-dir=`` must be used to point to the expected input files. Build and run the Mona report as:: @@ -407,6 +417,13 @@ Build and run the Mona report as:: This will produce plots and an HTML file in subdirectory starting with ``reports_`` followed by a representation of the current date and time. +Finally there is a tool to perform timing tests of RSA decryption using the +MARVIN toolkit (https://github.com/tomato42/marvin-toolkit):: + + $ botan marvin_test marvin_key marvin_datadir --runs=100000 + +Consult the documentation for MARVIN for more about how to run this. + References --------------- @@ -420,6 +437,9 @@ References "Resistance against Differential Power Analysis for Elliptic Curve Cryptosystems" (https://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.1.5695) +[GcdFree] Joye, Paillier "GCD-Free Algorithms for Computing Modular Inverses" +(https://marcjoye.github.io/papers/JP03gcdfree.pdf) + [InvalidCurve] Biehl, Meyer, Müller: Differential fault attacks on elliptic curve cryptosystems (https://www.iacr.org/archive/crypto2000/18800131/18800131.pdf)
0
93
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
679b535b0d0f3d0276d463ac927c27bd4411e217
Document TLS::Client constructor change
commit 679b535b0d0f3d0276d463ac927c27bd4411e217 Author: lloyd <[email protected]> Date: Wed Oct 31 00:03:17 2012 +0000 Document TLS::Client constructor change diff --git a/doc/tls.rst b/doc/tls.rst index 3aec3254c..36ef80574 100644 --- a/doc/tls.rst +++ b/doc/tls.rst @@ -8,7 +8,8 @@ Botan supports both client and server implementations of the SSL/TLS protocols, including SSL v3, TLS v1.0, TLS v1.1, and TLS v1.2 (the insecure and obsolete SSL v2 protocol is not supported, beyond processing SSL v2 client hellos which some clients still send for -backwards compatability with ancient servers). +backwards compatability with ancient servers). DTLS, a variant of TLS +adapted for operation on datagram sockets, is also supported. The TLS implementation does not know anything about sockets or networks. Instead, it calls a user provided callback (hereafter @@ -166,6 +167,7 @@ TLS Clients const TLS::Policy& policy, \ RandomNumberGenerator& rng, \ const Server_Information& server_info = Server_Information(), \ + const Protocol_Version offer_version = Protocol_Version::latest_tls_version(), std::function<std::string, std::vector<std::string>> next_protocol) Initialize a new TLS client. The constructor will immediately @@ -211,6 +213,23 @@ TLS Clients select what certificate to use and helps the client validate the connection. + Use *offer_version* to control the version of TLS you wish the + client to offer. Normally, you'll want to offer the most recent + version of TLS that is available, however some broken servers are + intolerant of certain versions being offered, and for classes of + applications that have to deal with such servers (typically web + browsers) it may be necessary to implement a version backdown + strategy if the initial attempt fails. + + Setting *offer_version* is also used to offer DTLS instead of TLS; + use :cpp:func:`TLS::Protocol_Version::latest_dtls_version`. + + .. warning:: + + Implementing such a backdown strategy allows an attacker to + downgrade your connection to the weakest protocol that both you + and the server support. + The optional *next_protocol* callback is called if the server indicates it supports the next protocol notification extension. The callback wlil be called with a list of protocol names that the @@ -648,6 +667,16 @@ The ``TLS::Protocol_Version`` class represents a specific version: ``SSL_V3``, ``TLS_V10``, ``TLS_V11``, ``TLS_V12``, ``DTLS_V10``, ``DTLS_V12`` + .. cpp:function:: static Protocol_Version latest_tls_version() + + Returns the latest version of TLS supported by this implementation + (currently TLS v1.2) + + .. cpp:function:: static Protocol_Version latest_dtls_version() + + Returns the latest version of DTLS supported by this implementation + (currently DTLS v1.2) + .. cpp:function:: Protocol_Version(Version_Code named_version) Create a specific version
0
32
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
9409fb0d1a20f2b2c5fc7323db185a524cf4a48f
Update release notes [ci skip]
commit 9409fb0d1a20f2b2c5fc7323db185a524cf4a48f Author: Jack Lloyd <[email protected]> Date: Wed Dec 14 22:08:53 2016 -0500 Update release notes [ci skip] diff --git a/news.rst b/news.rst index 396164068..23729c92c 100644 --- a/news.rst +++ b/news.rst @@ -4,6 +4,14 @@ Release Notes Version 1.11.35, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* Fix a longstanding bug in modular exponentiation which caused most + exponentiations modulo an even number to have an incorrect result; such moduli + occur only rarely in cryptographic contexts. GH #754 + +* Fix a bug in BigInt multiply operation, introduced in 1.11.30, which could + cause incorrect results. Found by OSS-Fuzz fuzzing the ressol function, where + the bug manifested as an incorrect modular exponentiation. OSS-Fuzz bug #287 + * Changes all Public_Key derived class ctors to take a std::vector instead of a secure_vector for the DER encoded public key bits. (GH #768)
0
16
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
41a52cf998e798f5ebf73d5e3e3549d4152e546e
Make readme sound less scary, since 1.7.23 will be 1.8.0 RC2
commit 41a52cf998e798f5ebf73d5e3e3549d4152e546e Author: lloyd <[email protected]> Date: Fri Nov 21 17:05:33 2008 +0000 Make readme sound less scary, since 1.7.23 will be 1.8.0 RC2 diff --git a/readme.txt b/readme.txt index 3057c069b..06cc1ab0b 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,9 @@ Botan 1.7.23-pre ????-??-?? http://botan.randombit.net/ -Please note that this is an experimental / development version of -Botan. Feedback and critical analysis is highly appreciated. There may -be bugs (as always). APIs may be changed with little or no notice. If -this sounds scary, it's recommended you use the latest stable release -instead. +This release of Botan is the second release candidate for the 1.8.0 +release. It should be stable, though some APIs have changed +incompatibly since the 1.6 release. You can file bugs at http://www.randombit.net/bugzilla or by sending mail to the botan-devel mailing list.
0
45
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
d7a1b9c762ec043e83f8b9389c3eca40e18f0022
Update news
commit d7a1b9c762ec043e83f8b9389c3eca40e18f0022 Author: Jack Lloyd <[email protected]> Date: Mon Sep 18 11:00:34 2017 -0400 Update news diff --git a/news.rst b/news.rst index 5bc4c13f4..c30cfd467 100644 --- a/news.rst +++ b/news.rst @@ -30,6 +30,12 @@ Version 2.3.0, Not Yet Released * Add ids to allow SHA-3 signatures with PKCSv1.5 (GH #1184) +* GCM now supports truncated tags in the range 96...128 bits. GCM had + previously supported 64-bit truncated tags, but these are known to + be insecure and are now deprecated. (GH #1210 #1207) + +* Fix decoding of ECC keys that use extensions from RFC 5915 (GH #1208) + * The entropy source that called CryptGenRandom has been removed, and replaced by a version which invokes the system PRNG, which may be CryptGenRandom or some other source. (GH #1180) @@ -83,14 +89,30 @@ Version 2.3.0, Not Yet Released * Fix Altivec runtime detection, which was broken starting in Botan 2.1.0 +* Previously ARM feature detection (NEON, AES, ...) relied on getauxval, which + is only supported on Linux and Android. Now iOS is supported, by checking the + model name/version and matching it against known versions. Unfortunately this + is the best available technique on iOS. On Aarch64 systems that are not iOS or + Linux/Android, a technique based on trial execution while catching SIGILL is + used. (GH #1213) + +* The output of `botan config libs` was incorrect, it produced `-lbotan-2.X` + where X is the minor version, instead of the actual lib name `-lbotan-2`. + +* Add `constant_time_compare` as better named equivalent of `same_mem`. + * Silence a Clang warning in create_private_key (GH #1150) * The fuzzers have been better integrated with the main build. See the handbook for details. (GH #1158) -* The Travis CI build is now run via a Python script. This makes it - easier to replicate the behavior of the CI build locally. Also a number - of changes were made to improve the turnaround time of CI builds. (GH #1162) +* The Travis CI and AppVeyor CI builds are now run via a Python script. This + makes it easier to replicate the behavior of the CI build locally. Also a + number of changes were made to improve the turnaround time of CI builds. + (GH #1162 #1199) + +* Add support for Win32 filesystem operation, so the tests pass completely + on MinGW now (GH #1203) * Added a script to automate running TLS-Attacker tests.
0
100
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a8316c17d3db4087bf4933502f205a92c9232c79
Add some more todos for Memory_Pool
commit a8316c17d3db4087bf4933502f205a92c9232c79 Author: Jack Lloyd <[email protected]> Date: Thu Mar 28 11:08:52 2019 -0400 Add some more todos for Memory_Pool diff --git a/src/lib/utils/mem_pool/mem_pool.cpp b/src/lib/utils/mem_pool/mem_pool.cpp index 98997a38a..9542ecbfa 100644 --- a/src/lib/utils/mem_pool/mem_pool.cpp +++ b/src/lib/utils/mem_pool/mem_pool.cpp @@ -62,8 +62,28 @@ namespace Botan { * and that page being writable again, maximizing chances of crashing after a * use-after-free. * +* Future work +* ------------- +* +* The allocator is protected by a global lock. It would be good to break this +* up, since almost all of the work can actually be done in parallel especially +* when allocating objects of different sizes (which can't possibly share a +* bucket). +* * It may be worthwhile to optimize deallocation by storing the Buckets in order * (by pointer value) which would allow binary search to find the owning bucket. +* +* A useful addition would be to randomize the allocations. Memory_Pool would be +* changed to receive also a RandomNumberGenerator& object (presumably the system +* RNG, or maybe a ChaCha_RNG seeded with system RNG). Then the bucket to use and +* the offset within the bucket would be chosen randomly, instead of using first fit. +* +* Right now we don't make any provision for threading, so if two threads both +* allocate 32 byte values one after the other, the two allocations will likely +* share a cache line. Ensuring that distinct threads will (tend to) use distinct +* buckets would reduce this. +* +* Supporting a realloc-style API may be useful. */ namespace {
0
89
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
35657e0f76931f0d3a333610e7065c81c35e9f1e
Update relnotes [ci skip]
commit 35657e0f76931f0d3a333610e7065c81c35e9f1e Author: Jack Lloyd <[email protected]> Date: Mon Oct 10 01:18:18 2016 -0400 Update relnotes [ci skip] diff --git a/doc/news.rst b/doc/news.rst index ebc44e87a..ad3015082 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -4,11 +4,47 @@ Release Notes Version 1.11.33, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* Add support for the TLS Supported Point Formats Extension (RFC 4492). - -* Fix entropy source selection bug on Windows, which caused the - CryptoAPI entropy source to be not available under its normal name - "win32_cryptoapi" but instead "dev_random". GH #644 +* Add Certificate_Store_In_SQL which supports storing certs, keys, and + revocation information in a SQL database. Subclass Certificate_Store_In_SQLite + specializes with support for SQLite3 databases. (GH #631) + +* The Certificate_Store interface has been changed to deal with std::shared_ptrs + instead of raw pointers (GH #471 #631) + +* Add support for the TLS Supported Point Formats Extension from RFC 4492. Adds + TLS::Policy::use_ecc_point_compression policy option. If supported on both + sides, ECC points can be sent in compressed format, which both saves a few + bytes on the wire and is an inexpensive way of avoiding invalid curve attacks. + For uncompressed points Botan already checks that the point is on the curve so + invalid curve attacks are not possible in either situation, but the point + decompression will typically be cheaper than verifying the point is on the + curve. (GH #645) + +* Fix entropy source selection bug on Windows, which caused the CryptoAPI + entropy source to be not available under its normal name "win32_cryptoapi" but + instead "dev_random". GH #644 + +* Accept read-only access to /dev/urandom. System_RNG previously required + read-write access, to allow applications to provide inputs to the system + PRNG. But local security policies might only allow read-only access, as is the + case with Ubuntu's AppArmor profile for applications in the Snappy binary + format. If opening read/write fails, System_RNG silently backs down to + read-only, in which case calls to `add_entropy` on that object will fail. + (GH #647 #648) + +* Fix use of Win32 CryptoAPI RNG as an entropy source, which was accidentally + disabled due to empty list of acceptable providers being specified. Typically + the library would fall back to gathering entropy from OS functions returning + statistical information, but if this functionality was disabled in the build a + PRNG_Unseeded exception would result. (GH #655) + +* Added Linux ppc64le cross compile target to Travis CI (GH #654) + +* If RC4 is disabled, also disable it coming from the OpenSSL provider (GH #641) + +* Add TLS message parsing tests (GH #640) + +* Updated BSI policy to prohibit DES, HKDF, HMAC_RNG (GH #649) Version 1.11.32, 2016-09-28 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/todo.rst b/doc/todo.rst index 4e96bb147..0fde6807d 100644 --- a/doc/todo.rst +++ b/doc/todo.rst @@ -44,6 +44,7 @@ Public Key Crypto, Math External Providers, Hardware Support ---------------------------------------- +* Access to system certificate stores (Windows, OS X) * Extend OpenSSL provider (DH, HMAC, CMAC, GCM) * /dev/crypto provider (ciphers, hashes) * Windows CryptoAPI provider (ciphers, hashes, RSA)
0
65
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
b42403583adae5f0e374a9166c2ebb0d02544922
Document how to disable OS features [ci skip] Closes #1576
commit b42403583adae5f0e374a9166c2ebb0d02544922 Author: Jack Lloyd <[email protected]> Date: Thu Jul 5 10:52:21 2018 -0400 Document how to disable OS features [ci skip] Closes #1576 diff --git a/doc/manual/building.rst b/doc/manual/building.rst index c8f27c979..c09ee77ee 100644 --- a/doc/manual/building.rst +++ b/doc/manual/building.rst @@ -352,6 +352,33 @@ support this there is a flag to ``configure.py`` called inserted into ``build/build.h`` which is (indirectly) included into every Botan header and source file. +Enabling or Disabling Use of Certain OS Features +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Botan uses compile-time flags to enable or disable use of certain operating +specific functions. You can also override these at build time if desired. + +The default feature flags are given in the files in ``src/build-data/os`` in the +``target_features`` block. For example Linux defines flags like ``proc_fs``, +``getauxval``, and ``sockets``. The ``configure.py`` option +``--list-os-features`` will display all the feature flags for all operating +system targets. + +To disable a default-enabled flag, use ``--without-os-feature=feat1,feat2,...`` + +To enable a flag that isn't otherwise enabled, use ``--with-os-feature=feat``. +For example, modern Linux systems support the ``getentropy`` call, but it is not +enabled by default because many older systems lack it. However if you know you +will only deploy to recently updated systems you can use +``--with-os-feature=getentropy`` to enable it. + +A special case if dynamic loading, which applications for certain environments +will want to disable. There is no specific feature flag for this, but +``--disable-modules=dyn_load`` will prevent it from being used. + +.. note:: Disabling ``dyn_load`` module will also disable the PKCS #11 + wrapper, which relies on dynamic loading. + Configuration Parameters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0
99
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
490560a33e35e37a4d2f817abc9b6f10f40bc93c
Port in 1.10.2 change notes
commit 490560a33e35e37a4d2f817abc9b6f10f40bc93c Author: lloyd <[email protected]> Date: Sun Jun 17 18:53:44 2012 +0000 Port in 1.10.2 change notes diff --git a/doc/log.txt b/doc/log.txt index 701497220..bc0990747 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -54,18 +54,23 @@ Version 1.11.0, Not Yet Released Series 1.10 ---------------------------------------- -Version 1.10.2, Not Yet Released +Version 1.10.2, 2012-06-17 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* To protect clients against renegotiation attacks, the TLS client + now sends the renegotiation extension SCSV. + +* TLS renegotiation is completely disabled in this release. All hello + requests, and all client hellos after the initial negotiation, are + ignored. + +* Fix bugs in TLS affecting DSA servers. + * Pipe::reset no longer requires that message processing be completed, a requirement that caused problems when a Filter's end_msg call threw an exception, after which point the Pipe object was no longer usable. -* The SSL/TLS code is disabled by default in this release. A new - version is being developed and the current iteration should not be - used unless needed for existing code. - * Add support for the rdrand instruction introduced in Intel's Ivy Bridge processors.
0
11
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
2bed788572ca42de65afef037630f1fb9d642378
Update migration guide
commit 2bed788572ca42de65afef037630f1fb9d642378 Author: Jack Lloyd <[email protected]> Date: Fri Feb 24 17:03:40 2023 -0500 Update migration guide diff --git a/doc/migration_guide.rst b/doc/migration_guide.rst index b77bd21bb..f67961464 100644 --- a/doc/migration_guide.rst +++ b/doc/migration_guide.rst @@ -309,3 +309,17 @@ RSA. This is now no longer implemented. If you must generates such signatures for some horrible reason, you can pre-hash the message using a hash function as usual, and then sign using a "Raw" padding, which will allow you to sign any arbitrary bits with no preprocessing. + +Public Key Signature Padding +----------------------------- + +In previous versions Botan was somewhat lenient about allowing the application +to specify using a hash which was in fact incompatible with the algorithm. For +example, Ed25519 signatures are *always* generated using SHA-512; there is no +choice in the matter. In the past, requesting using some other hash, say +SHA-256, would be silently ignored. Now an exception is thrown, indicating the +desired hash is not compatible with the algorithm. + +In previous versions, various APIs required that the application specify the +hash function to be used. In most cases this can now be omitted (passing an +empty string) and a suitable default will be chosen.
0
57
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
64be4d88bd0fc0346d052110c1cb0d901ee9a850
Update relnotes
commit 64be4d88bd0fc0346d052110c1cb0d901ee9a850 Author: lloyd <[email protected]> Date: Sat Nov 15 14:57:40 2014 +0000 Update relnotes diff --git a/doc/relnotes/1_11_10.rst b/doc/relnotes/1_11_10.rst index 3ff9e0113..ed0955aea 100644 --- a/doc/relnotes/1_11_10.rst +++ b/doc/relnotes/1_11_10.rst @@ -12,9 +12,24 @@ Version 1.11.10, Not Yet Released ciphersuites, which use L=3. Thanks to Manuel Pégourié-Gonnard for the anaylsis and patch. Bugzilla 270. +* DTLS now supports timeouts and handshake retransmits. + +* Add a TLS policy hook to disable putting the value of the local + clock in hello random fields. + +* Avoid a crash in low-entropy situations when reading from + /dev/random, when select indicated the device was readable but by + the time we start the read the entropy pool had been depleted. + * The Miller-Rabin primality test function now takes a parameter allowing the user to directly specify the maximum false negative probability they are willing to accept. * Fix decoding indefinite length BER constructs that contain a context sensitive tag of zero. Github pull 26 from Janusz Chorko. + +* Add a new install script written in Python which replaces shell + hackery in the makefiles. + +* Various modifications to better support Visual C++ 2013 and 2015. + Github issues 11, 17, 18, 21, 22.
0
34
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
709aad063e72a1cd157ee0768e6677bc1cadfd6d
Update release notes
commit 709aad063e72a1cd157ee0768e6677bc1cadfd6d Author: Jack Lloyd <[email protected]> Date: Thu Oct 20 20:16:40 2016 -0400 Update release notes diff --git a/doc/news.rst b/doc/news.rst index 80a8457e3..471c4ffb8 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -11,6 +11,15 @@ Version 1.11.33, Not Yet Released * The Certificate_Store interface has been changed to deal with std::shared_ptrs instead of raw pointers (GH #471 #631) +* Add support for official SHA-3. Keccak-1600 was already supported + but used different padding from FIPS 202. + +* Add SHAKE-128 based stream cipher. + +* NewHope now supports the AES-128/CTR + SHA-256 parameters used by + BoringSSL in addition to the SHA-3/SHAKE-128 parameters used by the + reference implementation. + * Add support for the TLS Supported Point Formats Extension from RFC 4492. Adds TLS::Policy::use_ecc_point_compression policy option. If supported on both sides, ECC points can be sent in compressed format which saves a few bytes @@ -34,6 +43,24 @@ Version 1.11.33, Not Yet Released statistical information, but if this functionality was disabled in the build a PRNG_Unseeded exception would result. (GH #655) +* Add support for building the library as part of the IncludeOS unikernel. + This included making filesystem and threading support optional. (GH #665) + +* Added ISA annotations so that with GCC (all supported versions) and + Clang (since 3.7) it is no longer required to compile amalgamation + files with ABI specific flags such as ``-maes``. (GH #665) + +* Internal cleanups to TLS CBC record handling. TLS CBC ciphersuites + can now be disabled by disabling `tls_cbc` module. + +* Avoid static_assert triggering under MSVC debug builds (GH #646) + +* The antique PBKDF1 password hashing scheme is deprecated and will be + removed in a future release. It was only used to support the equally + ancient PBES1 private key encryption scheme, which was removed in 1.11.8. + +* Added MSVC debug/checked iterator builds (GH #666 #667) + * Added Linux ppc64le cross compile target to Travis CI (GH #654) * If RC4 is disabled, also disable it coming from the OpenSSL provider (GH #641) @@ -42,6 +69,8 @@ Version 1.11.33, Not Yet Released * Updated BSI policy to prohibit DES, HKDF, HMAC_RNG (GH #649) +* Documentation improvements (GH #660 #662 #663 #670) + Version 1.11.32, 2016-09-28 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0
78
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
45df55aa433f3d81a481565c5494804671a70f91
Fix for configure.py. Add instructions on building Python and Perl wrappers
commit 45df55aa433f3d81a481565c5494804671a70f91 Author: lloyd <[email protected]> Date: Fri Oct 9 18:29:13 2009 +0000 Fix for configure.py. Add instructions on building Python and Perl wrappers diff --git a/doc/building.tex b/doc/building.tex index aa4435c14..cae0bfd5e 100644 --- a/doc/building.tex +++ b/doc/building.tex @@ -41,61 +41,58 @@ POSIX (such as VMS, MacOS 9, OS/390, OS/400, ...) are not supported by the build system, primarily due to lack of access. Please contact the maintainer if you would like to build Botan on such a system. -Botan's build is controlled by configure.pl, which is a Perl -script. Perl 5.6 or later is required. +Botan's build is controlled by configure.py, which is a Python +script. Python 2.4 or later is required. \section{For the Impatient} \begin{verbatim} -$ ./configure.pl [--prefix=/some/directory] +$ ./configure.py [--prefix=/some/directory] $ make $ make install \end{verbatim} Or using \verb|nmake|, if you're compiling on Windows with Visual C++. On platforms that do not understand the '\#!' convention for -beginning script files, or that have Perl installed in an unusual -spot, you might need to prefix the \texttt{configure.pl} command with -\texttt{perl} or \texttt{/path/to/perl}. +beginning script files, or that have Python installed in an unusual +spot, you might need to prefix the \texttt{configure.py} command with +\texttt{python} or \texttt{/path/to/python}. \section{Building the Library} -The first step is to run \filename{configure.pl}, which is a Perl +The first step is to run \filename{configure.py}, which is a Python script that creates various directories, config files, and a Makefile -for building everything. The script requires at least Perl 5.6; any -later version should also work. +for building everything. The script requires at least Python 2.4; any +later version of Python 2.x should also work. The script will attempt to guess what kind of system you are trying to compile for (and will print messages telling you what it guessed). You can override this process by passing the options \verb|--cc|, -\verb|--os|, and \verb|--cpu| -- acceptable values are printed if -you run \verb|configure.pl| with \verb|--help|. +\verb|--os|, and \verb|--cpu|. You can pass basically anything reasonable with \verb|--cpu|: the script knows about a large number of different architectures, their -sub-models, and common aliases for them. The script does not display -all the possibilities in its help message because there are simply too -many entries. You should only select the 64-bit version of a CPU (such -as ``sparc64'' or ``mips64'') if your operating system knows how to -handle 64-bit object code -- a 32-bit kernel on a 64-bit CPU will -generally not like 64-bit code. +sub-models, and common aliases for them. You should only select the +64-bit version of a CPU (such as ``sparc64'' or ``mips64'') if your +operating system knows how to handle 64-bit object code -- a 32-bit +kernel on a 64-bit CPU will generally not like 64-bit code. By default the script tries to figure out what will work on your -system, and use that. It will print a display at the end showing -which algorithms have and have not been abled. For instance on one -system we might see the line: +system, and use that. It will print a display at the end showing which +algorithms have and have not been enabled. For instance on one system +we might see lines like: \begin{verbatim} - (loading): entropy: [beos_stats] buf_es [cryptoapi_rng] - dev_random egd proc_walk unix_procs [win32_stats] + INFO: Skipping mod because CPU incompatible - asm_amd64 mp_amd64 mp_asm64 sha1_amd64 + INFO: Skipping mod because OS incompatible - cryptoapi_rng win32_stats + INFO: Skipping mod because compiler incompatible - mp_ia32_msvc + INFO: Skipping mod because loaded on request only - bzip2 gnump openssl qt_mutex zlib \end{verbatim} -The names listed in brackets are disabled, the others are -enabled. Here we see the list of entropy sources which are going to be -compiled into Botan. Since this particular line comes when Botan was -configuring for a Linux system, the Win32 and BeOS specific modules -were disabled, while modules that use Unix APIs and /dev/random are -built. +The ones that are 'loaded on request only' have to be explicitly asked +for, because they rely on third party libraries which your system +might not have. For instance to enable zlib support, add +\verb|--with-zlib| to your invocation of \verb|configure.py|. You can control which algorithms and modules are built using the options ``\verb|--enable-modules=MODS|'' and @@ -104,20 +101,6 @@ options ``\verb|--enable-modules=MODS|'' and Modules not listed on the command line will simply be loaded if needed or if configured to load by default. -Not all OSes or CPUs have specific support in -\filename{configure.pl}. If the CPU architecture of your system isn't -supported by \filename{configure.pl}, use 'generic'. This setting -disables machine-specific optimization flags. Similarly, setting OS to -'generic' disables things which depend greatly on OS support -(specifically, shared libraries). - -However, it's impossible to guess which options to give to a system -compiler. Thus, if you want to compile Botan with a compiler which -\filename{configure.pl} does not support, you will need to tell it how -that compiler works. This is done by adding a new file in the -directory \filename{src/build-data/cc}; the existing files should put you -in the right direction. - The script tries to guess what kind of makefile to generate, and it almost always guesses correctly (basically, Visual C++ uses NMAKE with Windows commands, and everything else uses Unix make with POSIX @@ -128,14 +111,12 @@ commonly used by Windows compilers. To add a new variant (eg, a build script for VMS), you will need to create a new template file in \filename{src/build-data/makefile}. -\pagebreak - \subsection{POSIX / Unix} The basic build procedure on Unix and Unix-like systems is: \begin{verbatim} - $ ./configure.pl [--enable-modules=<list>] [--cc=CC] + $ ./configure.py [--enable-modules=<list>] [--cc=CC] $ make # You may need to set your LD_LIBRARY_PATH or equivalent for ./check to run $ make check # optional, but a good idea @@ -148,9 +129,9 @@ found within your PATH. The \verb|make install| target has a default directory in which it will install Botan (typically \verb|/usr/local|). You can override this by using the \texttt{--prefix} argument to -\filename{configure.pl}, like so: +\filename{configure.py}, like so: -\verb|./configure.pl --prefix=/opt <other arguments>| +\verb|./configure.py --prefix=/opt <other arguments>| On some systems shared libraries might not be immediately visible to the runtime linker. For example, on Linux you may have to edit @@ -163,10 +144,10 @@ to include the directory that the Botan libraries were installed into. The situation is not much different here. We'll assume you're using Visual C++ (for Cygwin, the Unix instructions are probably more relevant). You need to -have a copy of Perl installed, and have both Perl and Visual C++ in your path. +have a copy of Python installed, and have both Python and Visual C++ in your path. \begin{verbatim} - > perl configure.pl --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU] + > python configure.py --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU] > nmake > nmake check # optional, but recommended \end{verbatim} @@ -244,7 +225,7 @@ environment in a different directory. \subsection{Local Configuration} You may want to do something peculiar with the configuration; to -support this there is a flag to \filename{configure.pl} called +support this there is a flag to \filename{configure.py} called \texttt{--with-local-config=<file>}. The contents of the file are inserted into \filename{build/build.h} which is (indirectly) included into every Botan header and source file. @@ -395,4 +376,70 @@ is less of a problem - only the developer needs to worry about it. As long as they can remember where they installed Botan, they just have to set the appropriate flags in their Makefile/project file. +\pagebreak + +\section{Language Wrappers} + +\subsection{Building the Python wrappers} + +The Python wrappers for Botan use Boost.Python, so you must have Boost +installed. To build the wrappers, add the flag + +\verb|--use-boost-python| + +to \verb|configure.py|. This will create a second makefile, +\verb|Makefile.python|, with instructions for building the Python +module. After building the library, execute + +\begin{verbatim} +$ make -f Makefile.python +\end{verbatim} + +to build the module. Currently only Unix systems are supported, and +the Makefile assumes that the version of Python you want to build +against is the same one you used to run \verb|configure.py|. + +To install the module, use the \verb|install| target. + +Examples of using the Python module can be seen in \filename{doc/python} + +\subsection{Building the Perl XS wrappers} + +To build the Perl XS wrappers, change your directory to +\filename{src/wrap/perl-xs} and run \verb|perl Makefile.PL|, then run +\verb|make| to build the module and \verb|make test| to run the test +suite. + +\begin{verbatim} +$ perl Makefile.PL +Checking if your kit is complete... +Looks good +Writing Makefile for Botan +$ make +cp Botan.pm blib/lib/Botan.pm +AutoSplitting blib/lib/Botan.pm (blib/lib/auto/Botan) +/usr/bin/perl5.8.8 /usr/lib64/perl5/5.8.8/ExtUtils/xsubpp [...] +g++ -c -Wno-write-strings -fexceptions -g [...] +Running Mkbootstrap for Botan () +chmod 644 Botan.bs +rm -f blib/arch/auto/Botan/Botan.so +g++ -shared Botan.o -o blib/arch/auto/Botan/Botan.so \ + -lbotan -lbz2 -lpthread -lrt -lz \ + +chmod 755 blib/arch/auto/Botan/Botan.so +cp Botan.bs blib/arch/auto/Botan/Botan.bs +chmod 644 blib/arch/auto/Botan/Botan.bs +Manifying blib/man3/Botan.3pm +$ make test +PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 [...] +t/base64......ok +t/filt........ok +t/hex.........ok +t/oid.........ok +t/pipe........ok +t/x509cert....ok +All tests successful. +Files=6, Tests=83, 0 wallclock secs ( 0.08 cusr + 0.02 csys = 0.10 CPU) +\end{verbatim} + \end{document}
0
79
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
50f3a247881a1fc5293ddf2357594d1461e476b4
Document test and CI systems
commit 50f3a247881a1fc5293ddf2357594d1461e476b4 Author: Jack Lloyd <[email protected]> Date: Sat Jun 29 04:21:20 2019 -0400 Document test and CI systems diff --git a/doc/dev_ref/contents.rst b/doc/dev_ref/contents.rst index 05adaa331..6505762e1 100644 --- a/doc/dev_ref/contents.rst +++ b/doc/dev_ref/contents.rst @@ -9,6 +9,8 @@ contributions to the library contributing configure + test_framework + continuous_integration fuzzing release_process todo diff --git a/doc/dev_ref/continuous_integration.rst b/doc/dev_ref/continuous_integration.rst new file mode 100644 index 000000000..504435c75 --- /dev/null +++ b/doc/dev_ref/continuous_integration.rst @@ -0,0 +1,85 @@ +Continuous Integration and Automated Testing +=============================================== + +CI Build Script +---------------- + +The Travis and AppVeyor builds are orchestrated using a script +``src/scripts/ci_build.py``. This allows one to easily reproduce the +build steps of CI on a local machine. + +A seperate repo https://github.com/randombit/botan-ci-tools holds +binaries which are used by the CI. + +Travis CI +----------- + +https://travis-ci.org/randombit/botan + +This is the primary CI, and tests the Linux, macOS, and iOS builds. Among other +things it runs tests using valgrind, cross compilation to different +architectures (currently ARM, PowerPC and MIPS), MinGW build, and the a build +that produces the coverage report. + +The Travis configurations is in ``src/scripts/ci/travis.yml``, which executes a +setup script ``src/scripts/ci/setup_travis.sh`` to install needed packages. +Then ``src/scripts/ci_build.py`` is invoked. + +AppVeyor +---------- + +https://ci.appveyor.com/project/randombit/botan + +Runs a build/test cycle using MSVC on Windows. Like Travis it uses +``src/scripts/ci_build.py``. The AppVeyor setup script is in +``src/scripts/ci/setup_appveyor.bat`` + +The AppVeyor build uses ``sccache`` as a compiler cache. Since that is not +available in the AppVeyor images it takes a precompiled copy checked into the +``botan-ci-tools`` repo. + +Kullo CI +---------- + +This was the initial CI system and tests Linux, macOS, Windows, and Android +builds. Notably this is currently the only CI system Botan uses which has an +Android build enabled. It does not use ``ci_build.py``. This system is +maintained by @webmaster128 + +LGTM +--------- + +https://lgtm.com/projects/g/randombit/botan/ + +An automated linter that is integrated with Github. It automatically checks each +incoming PR. It also supports custom queries/alerts, which likely would be useful. + +Coverity +--------- + +https://scan.coverity.com/projects/624 + +An automated source code scanner. Use of Coverity scanner is rate-limited, +sometimes it is very slow to produce a new report, and occasionally the service +goes offline for days or weeks at a time. New reports are kicked off manually by +rebasing branch ``coverity_scan`` against the most recent master and force +pushing it. + +Sonar +------- + +https://sonarcloud.io/dashboard?id=botan + +Sonar scanner is another software quality scanner. Unfortunately a recent update +of their scanner caused it to take over an hour to produce a report which caused +Travis CI timeouts, so it has been disabled. It should be re-enabled to run on +demand in the same way Coverity is. + +OSS-Fuzz +---------- + +https://github.com/google/oss-fuzz/ + +OSS-Fuzz is a distributed fuzzer run by Google. Every night, each library fuzzer +in ``src/fuzzer`` is built and run on many machines with any findings reported +by email. diff --git a/doc/dev_ref/fuzzing.rst b/doc/dev_ref/fuzzing.rst index 519bae4e1..46e60fb53 100644 --- a/doc/dev_ref/fuzzing.rst +++ b/doc/dev_ref/fuzzing.rst @@ -88,4 +88,4 @@ have the signature: ``void fuzz(const uint8_t in[], size_t len)`` -After adding your fuzzer, rerun `./configure.py` and build. +After adding your fuzzer, rerun ``./configure.py`` and build. diff --git a/doc/dev_ref/mistakes.rst b/doc/dev_ref/mistakes.rst index 03b2c7905..6ea9ea927 100644 --- a/doc/dev_ref/mistakes.rst +++ b/doc/dev_ref/mistakes.rst @@ -1,6 +1,6 @@ -Mistakes -=========== +Mistakes Were Made +=================== These are mistakes made early on in the project's history which are difficult to fix now, but mentioned in the hope they may serve as an example for others. diff --git a/doc/dev_ref/reading_list.rst b/doc/dev_ref/reading_list.rst index b39046803..1b27d05d6 100644 --- a/doc/dev_ref/reading_list.rst +++ b/doc/dev_ref/reading_list.rst @@ -21,8 +21,8 @@ Implementation Techniques for aes_ssse3. * "Elliptic curves and their implementation" Langley - http://www.imperialviolet.org/2010/12/04/ecc.html - Describes sparse representations for ECC math + http://www.imperialviolet.org/2010/12/04/ecc.html + Describes sparse representations for ECC math Random Number Generation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -50,7 +50,7 @@ Public Key Side Channels http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.98.1028&rep=rep1&type=pdf * "Resistance against Differential Power Analysis for Elliptic Curve Cryptosystems" - Coron http://www.jscoron.fr/publications/dpaecc.pdf + Coron http://www.jscoron.fr/publications/dpaecc.pdf * "Further Results and Considerations on Side Channel Attacks on RSA" Klima, Rosa https://eprint.iacr.org/2002/071 diff --git a/doc/dev_ref/release_process.rst b/doc/dev_ref/release_process.rst index d1418777f..405801c81 100644 --- a/doc/dev_ref/release_process.rst +++ b/doc/dev_ref/release_process.rst @@ -1,6 +1,10 @@ Release Process and Checklist ======================================== +Releases are done quarterly, normally on the first non-holiday Monday +of January, April, July and October. A feature freeze goes into effect +starting 9 days before the release. + .. highlight:: shell .. note:: @@ -88,6 +92,9 @@ Don't forget to also push tags:: Build The Windows Installer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. note:: + We haven't distributed Windows binaries for some time. + On Windows, run ``configure.py`` to setup a build:: $ python ./configure.py --cc=msvc --cpu=$ARCH --distribution-info=unmodified diff --git a/doc/dev_ref/test_framework.rst b/doc/dev_ref/test_framework.rst new file mode 100644 index 000000000..241c51bd1 --- /dev/null +++ b/doc/dev_ref/test_framework.rst @@ -0,0 +1,314 @@ +Test Framework +================ + +Botan uses a custom-built test framework. Some portions of it are +quite similar to assertion-based test frameworks such as Catch or +Gtest, but it also includes many features which are well suited for +testing cryptographic algorithms. + +The intent is that the test framework and the test suite evolve +symbiotically; as a general rule of thumb if a new function would make +the implementation of just two distinct tests simpler, it is worth +adding to the framework on the assumption it will prove useful again. +Feel free to propose changes to the test system. + +When writing a new test, there are three key classes that are used, +namely ``Test``, ``Test::Result``, and ``Text_Based_Test``. A ``Test`` +(or ``Test_Based_Test``) runs and returns one or more ``Test::Result``. + +Namespaces in Test +------------------- + +The test code lives in a distinct namespace (``Botan_Tests``) and all +code in the tests which calls into the library should use the +namespace prefix ``Botan::`` rather than a ``using namespace`` +declaration. This makes it easier to see where the test is actually +invoking the library, and makes it easier to reuse test code for +applications. + +Test Data +----------- + +The test framework is heavily data driven. As of this writing, there +is about 1 Mib of test code and 17 MiB of test data. For most (though +certainly not all) tests, it is better to add a data file representing +the input and outputs, and run the tests over it. Data driven tests +make adding or editing tests easier, for example by writing scripts +which produce new test data and output it in the expected format. + +Test +-------- + +.. cpp:class:: Test + + .. cpp:function:: virtual std::vector<Test::Result> run() = 0 + + This is the key function of a ``Test``: it executes and returns a + list of results. Almost all other functions on ``Test`` are + static functions which just serve as helper functions for ``run``. + + .. cpp:function:: static std::string read_data_file(const std::string& path) + + Return the contents of a data file and return it as a string. + + .. cpp:function:: static std::vector<uint8_t> read_binary_data_file(const std::string& path) + + Return the contents of a data file and return it as a vector of + bytes. + + .. cpp:function:: static std::string data_file(const std::string& what) + + An alternative to ``read_data_file`` and ``read_binary_file``, + use only as a last result, typically for library APIs which + themselves accept a filename rather than a data blob. + + .. cpp:function:: static bool run_long_tests() const + + Returns true if the user gave option ``--run-long-tests``. Use + this to gate particularly time-intensive tests. + + .. cpp:function:: static Botan::RandomNumberGenerator& rng() + + Returns a reference to a fast, not cryptographically secure + random number generator. It is deterministicly seeded with the + seed logged by the test runner, so it is possible to reproduce + results in "random" tests. + +Tests are registered using the macro ``BOTAN_REGISTER_TEST`` which +takes 2 arguments: the name of the test and the name of the test class. +For example given a ``Test`` instance named ``MyTest``, use:: + + BOTAN_REGISTER_TEST("mytest", MyTest); + +All test names should contain only lowercase letters, numbers, and +underscore. + +Test::Result +------------- + +.. cpp:class:: Test::Result + + A ``Test::Result`` records one or more tests on a particular topic + (say "AES-128/CBC" or "ASN.1 date parsing"). Most of the test functions + return true or false if the test was successful or not; this allows + performing conditional blocks as a result of earlier tests:: + + if(result.test_eq("first value", produced, expected)) + { + // further tests that rely on the initial test being correct + } + + Only the most commonly used functions on ``Test::Result`` are documented here, + see the header ``tests.h`` for more. + + .. cpp:function:: Test::Result(const std::string& who) + + Create a test report on a particular topic. This will be displayed in the + test results. + + .. cpp:function:: bool test_success() + + Report a test that was successful. + + .. cpp:function:: bool test_success(const std::string& note) + + Report a test that was successful, including some comment. + + .. cpp:function:: bool test_failure(const std::string& err) + + Report a test failure of some kind. The error string will be logged. + + .. cpp:function:: bool test_failure(const std::string& what, const std::string& error) + + Report a test failure of some kind, with a description of what failed and + what the error was. + + .. cpp:function:: void test_failure(const std::string& what, const uint8_t buf[], size_t buf_len) + + Report a test failure due to some particular input, which is provided as + arguments. Normally this is only used if the test was using some + randomized input which unexpectedly failed, since if the input is + hardcoded or from a file it is easier to just reference the test number. + + .. cpp:function:: bool test_eq(const std::string& what, const std::string& produced, const std::string& expected) + + Compare to strings for equality. + + .. cpp:function:: bool test_ne(const std::string& what, const std::string& produced, const std::string& expected) + + Compare to strings for non-equality. + + .. cpp:function:: bool test_eq(const char* producer, const std::string& what, \ + const uint8_t produced[], size_t produced_len, \ + const uint8_t expected[], size_t expected_len) + + Compare two arrays for equality. + + .. cpp:function:: bool test_ne(const char* producer, const std::string& what, \ + const uint8_t produced[], size_t produced_len, \ + const uint8_t expected[], size_t expected_len) + + Compare two arrays for non-equality. + + .. cpp:function:: bool test_eq(const std::string& producer, const std::string& what, \ + const std::vector<uint8_t>& produced, \ + const std::vector<uint8_t>& expected) + + Compare two vectors for equality. + + .. cpp:function:: bool test_ne(const std::string& producer, const std::string& what, \ + const std::vector<uint8_t>& produced, \ + const std::vector<uint8_t>& expected) + + Compare two vectors for non-equality. + + .. cpp:function:: bool confirm(const std::string& what, bool expr) + + Test that some expression evaluates to ``true``. + + .. cpp:function:: template<typename T> bool test_not_null(const std::string& what, T* ptr) + + Verify that the pointer is not null. + + .. cpp:function:: bool test_lt(const std::string& what, size_t produced, size_t expected) + + Test that ``produced`` < ``expected``. + + .. cpp:function:: bool test_lte(const std::string& what, size_t produced, size_t expected) + + Test that ``produced`` <= ``expected``. + + .. cpp:function:: bool test_gt(const std::string& what, size_t produced, size_t expected) + + Test that ``produced`` > ``expected``. + + .. cpp:function:: bool test_gte(const std::string& what, size_t produced, size_t expected) + + Test that ``produced`` >= ``expected``. + + .. cpp:function:: bool test_throws(const std::string& what, std::function<void ()> fn) + + Call a function and verify it throws an exception of some kind. + + .. cpp:function:: bool test_throws(const std::string& what, const std::string& expected, std::function<void ()> fn) + + Call a function and verify it throws an exception of some kind + and that the exception message exactly equals ``expected``. + +Text_Based_Test +----------------- + +A ``Text_Based_Text`` runs tests that are produced from a text file +with a particular format which looks somewhat like an INI-file:: + + # Comments begin with # and continue to end of line + [Header] + # Test 1 + Key1 = Value1 + Key2 = Value2 + + # Test 2 + Key1 = Value1 + Key2 = Value2 + +.. cpp:class:: VarMap + + An object of this type is passed to each invocation of the text-based test. + It is used to access the test variables. All access takes a key, which is + one of the strings which was passed to the constructor of ``Text_Based_Text``. + Accesses are either required (``get_req_foo``), in which case an exception is + throwing if the key is not set, or optional (``get_opt_foo``) in which case + the test provides a default value which is returned if the key was not set + for this particular instance of the test. + + .. cpp:function:: std::vector<uint8_t> get_req_bin(const std::string& key) const + + Return a required binary string. The input is assumed to be hex encoded. + + .. cpp:function:: std::vector<uint8_t> get_opt_bin(const std::string& key) const + + Return an optional binary string. The input is assumed to be hex encoded. + + .. cpp:function:: std::vector<std::vector<uint8_t>> get_req_bin_list(const std::string& key) const + + .. cpp:function:: Botan::BigInt get_req_bn(const std::string& key) const + + Return a required BigInt. The input can be decimal or (with "0x" prefix) hex encoded. + + .. cpp:function:: Botan::BigInt get_opt_bn(const std::string& key, const Botan::BigInt& def_value) const + + Return an optional BigInt. The input can be decimal or (with "0x" prefix) hex encoded. + + .. cpp:function:: std::string get_req_str(const std::string& key) const + + Return a required text string. + + .. cpp:function:: std::string get_opt_str(const std::string& key, const std::string& def_value) const + + Return an optional text string. + + .. cpp:function:: size_t get_req_sz(const std::string& key) const + + Return a required integer. The input should be decimal. + + .. cpp:function:: size_t get_opt_sz(const std::string& key, const size_t def_value) const + + Return an optional integer. The input should be decimal. + +.. cpp:class:: Text_Based_Test : public Test + + .. cpp:function:: Text_Based_Test(const std::string& input_file, \ + const std::string& required_keys, \ + const std::string& optional_keys = "") + + This constructor is + + .. note:: + The final element of required_keys is the "output key", that is + the key which signifies the boundary between one test and the next. + When this key is seen, ``run_one_test`` will be invoked. In the + test input file, this key must always appear least for any particular + test. All the other keys may appear in any order. + + .. cpp:function:: Test::Result run_one_test(const std::string& header, \ + const VarMap& vars) + + Runs a single test and returns the result of it. The ``header`` + parameter gives the value (if any) set in a ``[Header]`` block. + This can be useful to distinguish several types of tests within a + single file, for example "[Valid]" and "[Invalid]". + + .. cpp:function:: bool clear_between_callbacks() const + + By default this function returns ``false``. If it returns + ``true``, then when processing the data in the file, variables + are not cleared between tests. This can be useful when several + tests all use some common parameters. + +Test Runner +------------- + +If you are simply writing a new test there should be no need to modify +the runner, however it can be useful to be aware of its abilities. + +The runner can run tests concurrently across many cores. By default single +threaded execution is used, but you can use ``--test-threads`` option to +specify the number of threads to use. If you use ``--test-threads=0`` then +the runner will probe the number of active CPUs and use that (but limited +to at most 16). If you want to run across many cores on a large machine, +explicitly specify a thread count. The speedup is close to linear. + +The RNG used in the tests is deterministic, and the seed is logged for each +execution. You can cause the random sequence to repeat using ``--drbg-seed`` +option. + +.. note:: + Currently the RNG is seeded just once at the start of execution. So you + must run the exact same sequence of tests as the original test run in + order to get reproducible results. + +If you are trying to track down a bug that happens only occasionally, two very +useful options are ``--test-runs`` and ``--abort-on-first-fail``. The first +takes an integer and runs the specified test cases that many times. The second +causes abort to be called on the very first failed test. This is sometimes +useful when tracing a memory corruption bug.
0
91
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
b9f31bf1878119e964e4c1d3a4adec009bc6d35a
Update news
commit b9f31bf1878119e964e4c1d3a4adec009bc6d35a Author: Jack Lloyd <[email protected]> Date: Sun Nov 26 22:16:07 2017 -0500 Update news diff --git a/news.rst b/news.rst index 4cfbf2e1e..adc5279f2 100644 --- a/news.rst +++ b/news.rst @@ -16,6 +16,16 @@ Version 2.4.0, Not Yet Released * Add support for AES key wrapping with padding, as specified in RFC 5649 and NIST SP 800-38F (GH #1301) +* Fix several minor bugs in the TLS code caught by tlsfuzzer, mostly related to + sending the wrong alert type in various circumstances. + +* Add support for a ``tls_http_server`` command line utility which responds to + simple GET requests. This is useful for testing against a browser, or various + TLS test tools which expect the underlying protocol to be HTTP. (GH #1315) + +* Add an interface for generic PSK data stores, as well as an implementation + which encrypts stored values with AES key wrapping. (GH #1302) + * Optimize GCM mode on systems both with and without carryless multiply support. This includes a new base case implementation (still constant time), a new SSSE3 implementation for systems with SSSE3 but not clmul, and better
0
25
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
cdadd7c77bf761e28249e7f195862082bf9e5c64
Update todo
commit cdadd7c77bf761e28249e7f195862082bf9e5c64 Author: Jack Lloyd <[email protected]> Date: Mon Nov 7 11:09:14 2016 -0500 Update todo diff --git a/doc/todo.rst b/doc/todo.rst index fb97c5dc0..bb0fa499e 100644 --- a/doc/todo.rst +++ b/doc/todo.rst @@ -29,7 +29,6 @@ Ciphers, Hashes, PBKDF Public Key Crypto, Math ---------------------------------------- -* XMSS (draft-irtf-cfrg-xmss-hash-based-signatures) * SPHINCS-256 * EdDSA (GH #283) * Ed448-Goldilocks @@ -106,7 +105,7 @@ Compat Headers since the OpenSSL API handles both crypto and IO. Use Asio, since it is expected to be the base of future C++ standard network library. -FFI (Python, OCaml) +FFI and Bindings ---------------------------------------- * Expose certificates @@ -127,6 +126,17 @@ Build/Test * Test runner python script that captures backtraces and other debug info during CI +FIPS 140 Build +--------------------------------------- + +* Special build policy that disables all builtin crypto impls, then provides new + FIPS 140 versions implemented using just calls to the OpenSSL FIPS module API + plus wrapping the appropriate functions for self-tests and so on. This creates a + library in FIPS 140 validated form (since there is no 'crypto' anymore from + Botan, just the ASN.1 parser, TLS library, PKI etc all of which FIPS 140 does + not care about) without the enourmous hassle and expense of actually having to + maintain a FIPS validation on Botan. + CLI ----------------------------------------
0
39
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
3c0ced9e7ce806d637b4c1a65f3d1ce13f6322d2
Update news
commit 3c0ced9e7ce806d637b4c1a65f3d1ce13f6322d2 Author: Jack Lloyd <[email protected]> Date: Sat Aug 11 19:03:25 2018 -0400 Update news diff --git a/news.rst b/news.rst index 25bdd8d1b..30c3d9958 100644 --- a/news.rst +++ b/news.rst @@ -20,6 +20,9 @@ Version 2.8.0, Not Yet Released * Add support for using the ARMv8 instructions for SM4 encryption (GH #1622) +* The Python module has much better error checking and reporting, and offers new + functionality such as scrypt. (GH #1643) + * Fixed a bug that caused CCM to fail with an exception when used with L=8 (GH #1631 #1632)
0
24
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
cc929c0040d5bb6d5deee92a523c1d425cd300c8
Doc: migration guide update for tls_session_established
commit cc929c0040d5bb6d5deee92a523c1d425cd300c8 Author: Rene Meusel <[email protected]> Date: Tue Mar 7 09:20:17 2023 +0100 Doc: migration guide update for tls_session_established diff --git a/doc/migration_guide.rst b/doc/migration_guide.rst index c2cf372e3..d5ba8f792 100644 --- a/doc/migration_guide.rst +++ b/doc/migration_guide.rst @@ -69,6 +69,19 @@ tls_record_received() / tls_emit_data() Those callbacks now take `std::span<const uint8_t>` instead of `const uint8_t*` with a `size_t` buffer length. +tls_session_established() +""""""""""""""""""""""""" + +This callback provides a summary of the just-negotiated connection. It used to +have a bool return value letting an application decide to store or discard the +connection's resumption information. This use case is now provided via: +`tls_should_persist_resumption_information()` which might be called more than +once for a single TLS 1.3 connection. + +`tls_session_established` is not a mandatory callback anymore but still allows +applications to abort a connection given a summary of the negotiated +characteristics. Note that this summary is not a persistable `Session` anymore. + tls_verify_cert_chain() """""""""""""""""""""""
0
68
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
fea19eac78648080986124539f7818c2754411d2
Update migration guide
commit fea19eac78648080986124539f7818c2754411d2 Author: Rene Meusel <[email protected]> Date: Tue Apr 4 15:28:00 2023 +0200 Update migration guide diff --git a/doc/migration_guide.rst b/doc/migration_guide.rst index 745d2bfa3..b94df2deb 100644 --- a/doc/migration_guide.rst +++ b/doc/migration_guide.rst @@ -26,6 +26,12 @@ algorithm headers (such as ``aes.h``) have been removed. Instead you should create objects via the factory methods (in the case of AES, ``BlockCipher::create``) which works in both 2.x and 3.0 +Build Artifacts +--------------- + +For consistency with other platforms the DLL is now suffixed with the library's +major version on Windows as well. + TLS --- @@ -33,6 +39,13 @@ Starting with Botan 3.0 TLS 1.3 is supported. This development required a number of backward-incompatible changes to accomodate the protocol differences to TLS 1.2, which is still supported. +Build modules +^^^^^^^^^^^^^ + +The build module ``tls`` is now internal and contains common TLS helpers. Users +have to explicitly enable ``tls12`` and/or ``tls13``. Note that for Botan 3.0 it +is not (yet) possible to exclusively enable TLS 1.3 at build time. + Removed Functionality ^^^^^^^^^^^^^^^^^^^^^
0
35
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
89a3150032bc56cc288e175cac31fa7a3514705c
Always set the position to the start of the block when generating a new block of data in the X9.31 PRNG (previously, adding entropy would cause a new block to be computed but the read pointer would be the same as it had been in the old block). Nominally this is very slightly faster (we don't throw away bytes we just computed) but the change is more to make the code more obvious/explicit; I was surprised by its old behavior, which seems bad. In theory it could introduce additional weaknesses, if gaining advantage to this partial block that was being thrown away assisted in an attack (I do not know of any attacks against the X9.31 PRNG that work that way, however).
commit 89a3150032bc56cc288e175cac31fa7a3514705c Author: lloyd <[email protected]> Date: Tue Apr 15 19:12:30 2008 +0000 Always set the position to the start of the block when generating a new block of data in the X9.31 PRNG (previously, adding entropy would cause a new block to be computed but the read pointer would be the same as it had been in the old block). Nominally this is very slightly faster (we don't throw away bytes we just computed) but the change is more to make the code more obvious/explicit; I was surprised by its old behavior, which seems bad. In theory it could introduce additional weaknesses, if gaining advantage to this partial block that was being thrown away assisted in an attack (I do not know of any attacks against the X9.31 PRNG that work that way, however). diff --git a/src/x931_rng.cpp b/src/x931_rng.cpp index ee21d480e..01b8c33d2 100644 --- a/src/x931_rng.cpp +++ b/src/x931_rng.cpp @@ -29,10 +29,7 @@ void ANSI_X931_RNG::randomize(byte out[], u32bit length) throw(PRNG_Unseeded) position += copied; if(position == R.size()) - { update_buffer(); - position = 0; - } } } @@ -53,6 +50,8 @@ void ANSI_X931_RNG::update_buffer() xor_buf(V, R, DT, BLOCK_SIZE); cipher->encrypt(V); + + position = 0; } /*************************************************
0
7
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
ec326f7e2afa7553c646e5ed841e924a43216850
Fix configure.py for CPython 2.6 Based on GH #362 by emilymaier
commit ec326f7e2afa7553c646e5ed841e924a43216850 Author: Jack Lloyd <[email protected]> Date: Mon Jan 4 11:07:32 2016 -0500 Fix configure.py for CPython 2.6 Based on GH #362 by emilymaier diff --git a/configure.py b/configure.py index c76cad0aa..28fe28b17 100755 --- a/configure.py +++ b/configure.py @@ -8,7 +8,14 @@ Configuration program for botan Botan is released under the Simplified BSD License (see license.txt) -Tested with CPython 2.7 and 3.4. CPython 2.6 and earlier are not supported. +This script is regularly tested with CPython 2.7 and 3.5, and +occasionally tested with CPython 2.6 and PyPy 4. + +Support for CPython 2.6 will be dropped eventually, but is kept up for as +long as reasonably convenient. + +CPython 2.5 and earlier are not supported. + On Jython target detection does not work (use --os and --cpu). """ @@ -1801,7 +1808,7 @@ def main(argv = None): if argv is None: argv = sys.argv - class BotanConfigureLogHandler(logging.StreamHandler): + class BotanConfigureLogHandler(logging.StreamHandler, object): def emit(self, record): # Do the default stuff first super(BotanConfigureLogHandler, self).emit(record) @@ -1809,7 +1816,7 @@ def main(argv = None): if record.levelno >= logging.ERROR: sys.exit(1) - lh = BotanConfigureLogHandler(stream = sys.stdout) + lh = BotanConfigureLogHandler(sys.stdout) lh.setFormatter(logging.Formatter('%(levelname) 7s: %(message)s')) logging.getLogger().addHandler(lh) diff --git a/doc/news.rst b/doc/news.rst index 18583dc7c..929036163 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -84,6 +84,13 @@ Version 1.11.26, Not Yet Released * Export MGF1 function mgf1_mask GH #380 +* Work around a problem with some antivirus programs which causes the + ``shutil.rmtree`` and ``os.makedirs`` Python calls to occasionally + fail. The could prevent ``configure.py`` from running sucessfully + on such systems. GH #353 + +* Let ``configure.py`` run under CPython 2.6. GH #362 + Version 1.11.25, 2015-12-07 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0
71
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
57435587c32b8766074434ec695f3de762633940
Update the ECC side channel docs to reference the new implementation [ci skip]
commit 57435587c32b8766074434ec695f3de762633940 Author: Jack Lloyd <[email protected]> Date: Wed Jan 15 06:38:23 2025 -0500 Update the ECC side channel docs to reference the new implementation [ci skip] diff --git a/doc/side_channels.rst b/doc/side_channels.rst index 1ed5fe4d6..2243a4475 100644 --- a/doc/side_channels.rst +++ b/doc/side_channels.rst @@ -151,71 +151,62 @@ See eme_oaep.cpp. ECC point decoding ---------------------- -The API function OS2ECP, which is used to convert byte strings to ECC points, -verifies that all points satisfy the ECC curve equation. Points that do not -satisfy the equation are invalid, and can sometimes be used to break -protocols ([InvalidCurve] [InvalidCurveTLS]). See ec_point.cpp. +The API function EC_AffinePoint::deserialize, which is used to convert +byte strings to ECC points, verifies that all points satisfy the ECC +curve equation. Points that do not satisfy the equation are invalid, +and can sometimes be used to break protocols ([InvalidCurve] +[InvalidCurveTLS]). -ECC scalar multiply ----------------------- +The implementation is in the file pcurves_impl.h as +AffineCurvePoint::deserialize + +ECC scalar multiplication +-------------------------- + +Several elliptic curve scalar multiplication algorithms are implemented to +accomodate different use cases. The implementations can be found in +pcurves_impl.h as PrecomputedBaseMulTable, WindowedMulTable, and +WindowedMul2Table. + +WindowedMul2Table additionally implements a variable time scalar multiplication; +this is used only for verifying signatures. In the public API this is invoked +using the functions EC_Group::Mul2Table::mul2_vartime and +EC_Group::Mul2Table::mul2_vartime_x_mod_order_eq -There are several different implementations of ECC scalar multiplications which -depend on the API invoked. This include ``EC_Point::operator*``, -``EC_Group::blinded_base_point_multiply`` and -``EC_Group::blinded_var_point_multiply``. - -The ``EC_Point::operator*`` implementation uses the Montgomery ladder, which is -fairly resistant to side channels. However it leaks the size of the scalar, -because the loop iterations are bounded by the scalar size. It should not be -used in cases when the scalar is a secret. - -Both ``blinded_base_point_multiply`` and ``blinded_var_point_multiply`` apply -side channel countermeasures. The scalar is masked by a multiple of the group -order (this is commonly called Coron's first countermeasure [CoronDpa]), -currently the mask is scaled to be half the bit length of the order of the group. - -Botan stores all ECC points in Jacobian representation. This form allows faster -computation by representing points (x,y) as (X,Y,Z) where x=X/Z^2 and -y=Y/Z^3. As the representation is redundant, for any randomly chosen non-zero r, -(X*r^2,Y*r^3,Z*r) is an equivalent point. Changing the point values prevents an -attacker from mounting attacks based on the input point remaining unchanged over -multiple executions. This is commonly called Coron's third countermeasure, see -again [CoronDpa]. +All other scalar multiplication algorithms are written to avoid timing and cache +based side channels. Multiplication algorithms intended for use with secret +inputs also use scalar blinding and point rerandomization techniques [CoronDpa] +as additional precautions. See BlindedScalarBits in pcurves_impl.h The base point multiplication algorithm is a comb-like technique which -precomputes ``P^i,(2*P)^i,(3*P)^i`` for all ``i`` in the range of valid scalars. -This means the scalar multiplication involves only point additions and no -doublings, which may help against attacks which rely on distinguishing between -point doublings and point additions. The elements of the table are accessed by -masked lookups, so as not to leak information about bits of the scalar via a -cache side channel. However, whenever 3 sequential bits of the (masked) scalar -are all 0, no operation is performed in that iteration of the loop. This exposes -the scalar multiply to a cache-based side channel attack; scalar blinding is -necessary to prevent this attack from leaking information about the scalar. - -The variable point multiplication algorithm uses a fixed-window algorithm. Since -this is normally invoked using untrusted points (eg during ECDH key exchange) it -randomizes all inputs to prevent attacks which are based on chosen input -points. The table of precomputed multiples is accessed using a masked lookup -which should not leak information about the secret scalar to an attacker who can -mount a cache-based side channel attack. - -See ec_point.cpp and point_mul.cpp in src/lib/pubkey/ec_group +precomputes successive powers of the base point. During the online phase, +elements from this table are added together. The elements of the table are +accessed by masked lookups, so as not to leak information about bits of the +scalar via a cache side channel. + +The variable point multiplication algorithms use a fixed-window double-and-add +algorithm. The table of precomputed multiples is accessed using a masked lookup +which should not leak information about the secret scalar to side channels. + +For details see pcurves_impl.h in src/lib/math/pcurves/pcurves_impl ECDH ---------------------- -ECDH verifies (through its use of OS2ECP) that all input points received from -the other party satisfy the curve equation. This prevents twist attacks. The -same check is performed on the output point, which helps prevent fault attacks. +ECDH verifies that all input points received from the other party satisfy the +curve equation, preventing twist attacks. ECDSA ---------------------- Inversion of the ECDSA nonce k must be done in constant time, as any leak of even a single bit of the nonce can be sufficient to allow recovering the private -key. In Botan all inverses modulo an odd number are performed using a constant -time algorithm due to Niels Möller. +key. The inversion makes use of Fermat's little theorem. + +In addition to being constant time, the inversion and portions of the scalar +arithmetic use blinding. The inverse of k is computed as ``(k*z)^-1 * z``, and +the computation of ``s``, normally ``((x * r) + m)/k``, is computed instead as +``((((x * z) * r) + (m * z)) / k) / z``, for a random z. x25519 ----------------------
0
80
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
af3317ee983d52a27c79c6a733ce311734b00d33
Update timing for 3.x [ci skip] No reason to fork right now.
commit af3317ee983d52a27c79c6a733ce311734b00d33 Author: Jack Lloyd <[email protected]> Date: Thu Aug 23 06:32:19 2018 -0400 Update timing for 3.x [ci skip] No reason to fork right now. diff --git a/doc/manual/roadmap.rst b/doc/manual/roadmap.rst index 18052381d..6bcff5170 100644 --- a/doc/manual/roadmap.rst +++ b/doc/manual/roadmap.rst @@ -28,7 +28,6 @@ Adding support for databases storing encrypted PSKs and SRP credentials. ECC Refactoring ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Refactoring how elliptic curve groups are stored, sharing representation and allowing better precomputations (eg precomputing base point multiples). [Completed in 2.5.0] @@ -46,7 +45,7 @@ Elliptic Curve Pairings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ These are useful in many interesting protocols. Initially BN curves are the main -target (particularly BN-256 for compatability with Go's bn256 module) but likely +target (particularly BN-256 for compatibility with Go's bn256 module) but likely we'll also want BLS curves. TLS 1.3 @@ -67,11 +66,6 @@ likely not be available until sometime in 2019. ASN.1 Redesign ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. note:: - - This project has been deferred to 3.x as C++14 extended constexpr - will likely make it much easier to implement. - The current ASN.1 library (DER_Encoder/BER_Decoder) does make it roughly possible to write C++ code matching the ASN.1 structures. But it is not flexible enough for all cases and makes many unnecessary @@ -94,13 +88,13 @@ generated code, so the two goals of the redesign seem to reinforce each other. Longer View (Future Major Release) ---------------------------------------- -Eventually (currently estimated for summer 2019), Botan 3.x will be -released. This schedule allows some substantial time with Botan 2.x and 3.x -supported simultaneously, to allow for application switch over. +Eventually (currently estimated for 2020), Botan 3.x will be released. This +schedule allows some substantial time with Botan 2.x and 3.x supported +simultaneously, to allow for application switch over. This version will adopt C++17 and use new std types such as string_view, optional, and any, along with adopting memory span and guarded integer types. Likely C++17 constexpr will also be leveraged. In this future 3.x release, all deprecated features/APIs of 2.x will be removed. -However outside of that, breaking API changes should be relatively minimal. +Besides that, there should be no breaking API changes in the transition to 3.x diff --git a/doc/manual/support.rst b/doc/manual/support.rst index ca1351736..05332bf55 100644 --- a/doc/manual/support.rst +++ b/doc/manual/support.rst @@ -36,9 +36,7 @@ Of course many other modern OSes such as OpenBSD, NetBSD, AIX, Solaris or QNX are also probably fine (Botan has been tested on all of them successfully in the past), but none of the core developers run these OSes and may not be able to help so much in debugging problems. Patches to improve the build for these -platforms are welcome. Note that as a policy Botan does not support any OS which -is not supported by its original vendor; any such EOLed systems that are still -running are unpatched and insecure. +platforms are welcome, as are any reports of successful use. In theory any working C++11 compiler is fine but in practice, we only test with GCC, Clang, and Visual C++. There is support in the build system for several @@ -50,7 +48,7 @@ properly. Branch Support Status ------------------------- -Following table provides the support status for Botan branches as of May 2018. +Following table provides the support status for Botan branches as of August 2018. Any branch not listed here (including 1.11) is no longer supported. Dates in the future are approximate. @@ -59,8 +57,7 @@ Branch First Release End of Active Development End of Life ============== ============== ========================== ============ 1.8 2008-12-08 2010-08-31 2016-02-13 1.10 2011-06-20 2012-07-10 2018-12-31 -2.x 2017-01-06 2019-01-01 2021-12-31 -3.x (planned) 2019-07-01 2022-01-01 2023-12-31 +2.x 2017-01-06 2020? 2022 or later ============== ============== ========================== ============ "Active development" refers to adding new features and optimizations. At the
0
44
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
40a0a03655e51c3d335dca49da1d96ec0123897e
Update news
commit 40a0a03655e51c3d335dca49da1d96ec0123897e Author: Jack Lloyd <[email protected]> Date: Wed Nov 15 17:06:30 2017 -0500 Update news diff --git a/news.rst b/news.rst index e79f3e444..0734ca84e 100644 --- a/news.rst +++ b/news.rst @@ -22,10 +22,21 @@ Version 2.4.0, Not Yet Released * Various optimizations for OCB, CFB, CTR, SM3, SM4, GMAC, BLAKE2b, CRC24 (GH #1281) +* Salsa20 now supports the seek operation. + * Symmetric algorithms (block ciphers, stream ciphers, MACs) now verify that a key was set before accepting data. Previously attempting to use an unkeyed object would instead result in either a crash or invalid outputs. (GH #1279) +* The X509 certificate, CRL and PKCS10 types have been heavily refactored + internally. Previously all data of these types was serialized to strings, then + in the event a more complicated data structure (such as X509_DN) was needed, + it would be recreated from the string representation. However the round trip + process was not perfect and could cause fields to become lost. This approach + is no longer used, fixing several bugs (GH #1010 #1089 #1242 #1252). The + internal data is now stored in a ``shared_ptr``, so copying such objects is + now very cheap. (GH #884) + * ASN.1 string objects previously held their contents as ISO 8859-1 codepoints. However this led to certificates which contained strings outside of this character set (eg in Cyrillic, Greek, or Chinese) being rejected. Now the @@ -78,6 +89,13 @@ Version 2.4.0, Not Yet Released could be used was by manually constructing a ``CTR_BE`` object and setting the second parameter to something in the range of 1 to 3. +* A new mechanism for formatting ASN.1 data is included in ``asn1_print.h``. + This is the same functionality used by the command line ``asn1print`` util, + now cleaned up and moved to the library. + +* The size of ASN1_Tag is increased to 32 bits. This avoids a problem + with UbSan (GH #751) + * In 2.3.0, final annotations were added to many classes including the TLS policies (like ``Strict_Policy`` and ``BSI_TR_02102_2``). However it is reasonable and useful for an application to derive from one of these policies, so
0
28
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
02ed4e271a6287a0c23b137e826e62d2be752b82
Add a new configure.py option --distribution-info which sets a macro in build.h named BOTAN_DISTRIBUTION_INFO. The default value is 'unspecified'. People packaging botan could set this to another value, for instance 'Gentoo 1.9.13-r3' or 'Debian 1.9.13-1', or 'pristine' to indicate a completely unmodified/stock version. This was suggested by Zooko for Crypto++ in http://sourceforge.net/apps/trac/cryptopp/ticket/11 and seemed like an idea worth stealing. Don't default the version datestmap to the current day if unset, instead set to zero. This allows applications to detect unreleased versions. Document that version_datestamp will return zero for unreleased versions. Change the version_string function to return more information about the current version, including the release date and distribution information. It will now return strings like: Botan 1.9.13 (released 20110207, distribution Gentoo 1.9.13-r3) or for an unreleased version: Botan 1.9.13 (unreleased version, distribution unspecified)
commit 02ed4e271a6287a0c23b137e826e62d2be752b82 Author: lloyd <[email protected]> Date: Mon Feb 7 22:11:23 2011 +0000 Add a new configure.py option --distribution-info which sets a macro in build.h named BOTAN_DISTRIBUTION_INFO. The default value is 'unspecified'. People packaging botan could set this to another value, for instance 'Gentoo 1.9.13-r3' or 'Debian 1.9.13-1', or 'pristine' to indicate a completely unmodified/stock version. This was suggested by Zooko for Crypto++ in http://sourceforge.net/apps/trac/cryptopp/ticket/11 and seemed like an idea worth stealing. Don't default the version datestmap to the current day if unset, instead set to zero. This allows applications to detect unreleased versions. Document that version_datestamp will return zero for unreleased versions. Change the version_string function to return more information about the current version, including the release date and distribution information. It will now return strings like: Botan 1.9.13 (released 20110207, distribution Gentoo 1.9.13-r3) or for an unreleased version: Botan 1.9.13 (unreleased version, distribution unspecified) diff --git a/checks/check.cpp b/checks/check.cpp index 601e41227..e32f57ed7 100644 --- a/checks/check.cpp +++ b/checks/check.cpp @@ -127,8 +127,7 @@ int main(int argc, char* argv[]) if(opts.is_set("help") || argc <= 1) { std::cerr << "Test driver for " - << Botan::version_string() - << " (released " << Botan::version_datestamp() << ")\n" + << Botan::version_string() << "\n" << "Options:\n" << " --test || --validate: Run tests (do this at least once)\n" << " --benchmark: Benchmark everything\n" diff --git a/configure.py b/configure.py index b5422fdac..69381ef05 100755 --- a/configure.py +++ b/configure.py @@ -47,7 +47,7 @@ class BuildConfigurationInformation(object): version_so_patch = 13 version_suffix = '-dev' - version_datestamp = None + version_datestamp = 0 version_string = '%d.%d.%d%s' % ( version_major, version_minor, version_patch, version_suffix) @@ -59,10 +59,6 @@ class BuildConfigurationInformation(object): """ def __init__(self, options, modules): - # If not preset, use today - if self.version_datestamp is None: - self.version_datestamp = time.strftime("%Y%m%d", time.gmtime()) - self.build_dir = os.path.join(options.with_build_dir, 'build') self.checkobj_dir = os.path.join(self.build_dir, 'checks') @@ -229,6 +225,10 @@ def process_command_line(args): action='store_false', default=True, help=SUPPRESS_HELP) + build_group.add_option('--distribution-info', metavar='STRING', + help='set distribution specific versioning', + default='unspecified') + wrapper_group = OptionGroup(parser, 'Wrapper options') wrapper_group.add_option('--with-boost-python', dest='boost_python', @@ -243,7 +243,7 @@ def process_command_line(args): wrapper_group.add_option('--use-python-version', dest='python_version', metavar='N.M', default='.'.join(map(str, sys.version_info[0:2])), - help='specify version of Python to build against (eg %default)') + help='specify Python to build against (eg %default)') mods_group = OptionGroup(parser, 'Module selection') @@ -943,6 +943,8 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'version_patch': build_config.version_patch, 'version': build_config.version_string, + 'distribution_info': options.distribution_info, + 'version_datestamp': build_config.version_datestamp, 'so_version': build_config.soversion_string, diff --git a/doc/license.txt b/doc/license.txt index 6d9143ee1..f1b261eab 100644 --- a/doc/license.txt +++ b/doc/license.txt @@ -1,6 +1,6 @@ Botan (http://botan.randombit.net/) is distributed under these terms: -Copyright (C) 1999-2010 Jack Lloyd +Copyright (C) 1999-2011 Jack Lloyd 2001 Peter J Jones 2004-2007 Justin Karneges 2004 Vaclav Ovsik diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index fb5e5fabc..2682d2ad9 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -15,9 +15,10 @@ #define BOTAN_VERSION_MAJOR %{version_major} #define BOTAN_VERSION_MINOR %{version_minor} #define BOTAN_VERSION_PATCH %{version_patch} - #define BOTAN_VERSION_DATESTAMP %{version_datestamp} +#define BOTAN_DISTRIBUTION_INFO "%{distribution_info}" + #ifndef BOTAN_DLL #define BOTAN_DLL %{dll_import_flags} #endif diff --git a/src/utils/version.cpp b/src/utils/version.cpp index 22827cbe5..cf3205d19 100644 --- a/src/utils/version.cpp +++ b/src/utils/version.cpp @@ -1,12 +1,13 @@ /* * Version Information -* (C) 1999-2007 Jack Lloyd +* (C) 1999-2011 Jack Lloyd * * Distributed under the terms of the Botan license */ #include <botan/version.h> #include <botan/parsing.h> +#include <sstream> namespace Botan { @@ -21,9 +22,20 @@ namespace Botan { */ std::string version_string() { - return to_string(version_major()) + "." + - to_string(version_minor()) + "." + - to_string(version_patch()); + std::ostringstream out; + + out << "Botan " << version_major() << "." + << version_minor() << "." + << version_patch() << " ("; + + if(BOTAN_VERSION_DATESTAMP == 0) + out << "unreleased version"; + else + out << "released " << version_datestamp(); + + out << ", distribution " << BOTAN_DISTRIBUTION_INFO << ")"; + + return out.str(); } u32bit version_datestamp() { return BOTAN_VERSION_DATESTAMP; } diff --git a/src/utils/version.h b/src/utils/version.h index 13d0ac8bb..219c261a5 100644 --- a/src/utils/version.h +++ b/src/utils/version.h @@ -1,6 +1,6 @@ /* * Version Information -* (C) 1999-2007 Jack Lloyd +* (C) 1999-2011 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -18,16 +18,19 @@ namespace Botan { */ /** -* Get the version string identifying the version of Botan. +* Get a human-readable string identifying the version of Botan. +* No particular format should be assumed. * @return version string */ BOTAN_DLL std::string version_string(); /** -* Return the date this version of botan was released, in an -* integer of the form YYYYMMDD. For instance a version released -* on May 21, 2013 would return the integer 20130521 -* @return release date +* Return the date this version of botan was released, in an integer of +* the form YYYYMMDD. For instance a version released on May 21, 2013 +* would return the integer 20130521. If the currently running version +* is not an official release, this function will return 0 instead. +* +* @return release date, or zero if unreleased */ BOTAN_DLL u32bit version_datestamp();
0
47
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
d0c1e0418b82589ef207f23ce0828e9432532f9c
A little documentation about build roots and local configuration options.
commit d0c1e0418b82589ef207f23ce0828e9432532f9c Author: lloyd <[email protected]> Date: Sun Mar 4 08:53:06 2007 +0000 A little documentation about build roots and local configuration options. diff --git a/doc/building.tex b/doc/building.tex index 104121e64..448fcc4ac 100644 --- a/doc/building.tex +++ b/doc/building.tex @@ -183,11 +183,12 @@ This includes a pair of entropy sources for use on Windows; at some point in the future it will also add support for high-resolution timers, mutexes for thread safety, and other useful things. -For Win95 pre OSR2, the \verb|es_capi| module will not work, because CryptoAPI -didn't exist. All versions of NT4 lack the ToolHelp32 interface, which is how -\verb|es_win32| does it's slow polls, so a version of the library built with -that module will not load under NT4. Later systems (98/ME/2000/XP) support both -methods, so this shouldn't be much of an issue. +For Win95 pre OSR2, the \verb|es_capi| module will not work, because +CryptoAPI didn't exist. All versions of NT4 lack the ToolHelp32 +interface, which is how \verb|es_win32| does its slow polls, so a +version of the library built with that module will not load under +NT4. Later systems (98/ME/2000/XP) support both methods, so this +shouldn't be much of an issue. Unfortunately, there currently isn't an install script usable on Windows. Basically all you have to do is copy the newly created @@ -241,15 +242,19 @@ compressing. The default is 255, which means 'Unknown'. You can look in RFC also a Macintosh (7), but it probably makes more sense to use the Unix code on OS X. -\pagebreak - \subsection{Multiple Builds} -It may be useful to run multiple builds +It may be useful to run multiple builds with different +configurations. Specify \verb|--build-dir=<dir>| to set up a build +environment in a different directory. \subsection{Local Configuration} - +You may want to do something peculiar with the configuration; to +support this there is a flag to \filename{configure.pl} called +\texttt{--local-config=<file>}. The contents of the file are inserted into +\filename{build/build.h} which is (indirectly) included into every +Botan header and source file. \pagebreak @@ -351,45 +356,48 @@ unusual circumstances. The modules included with this release are: \subsection{Unix} Botan usually links in several different system libraries (such as -\texttt{librt} and \texttt{libz}), depending on which modules are configured at -compile time. In many environments, particularly ones using static libraries, -an application has to link against the same libraries as Botan for the linking -step to succeed. But how does it figure out what libraries it \emph{is} linked -against? - -The answer is to ask the \filename{botan-config} script. This basically solves -the same problem all the other \filename{*-config} scripts solve, and in -basically the same manner. At some point in the future, a transition to -\filename{pkg-config} will be made (as it's less work, and has more features), -but right now it doesn't exist on most Unix systems, while a plain Bourne shell -script will run fine on anything. +\texttt{librt} and \texttt{libz}), depending on which modules are +configured at compile time. In many environments, particularly ones +using static libraries, an application has to link against the same +libraries as Botan for the linking step to succeed. But how does it +figure out what libraries it \emph{is} linked against? + +The answer is to ask the \filename{botan-config} script. This +basically solves the same problem all the other \filename{*-config} +scripts solve, and in basically the same manner. At some point in the +future, a transition to \filename{pkg-config} will be made (as it's +less work, and has more features), but right now it doesn't exist on +most Unix systems, while a plain Bourne shell script will run fine on +anything. There are 4 options: -\texttt{--prefix[=DIR]}: If no argument, print the prefix where Botan is -installed (such as \filename{/opt} or \filename{/usr/local}). If an argument is -specified, other options given with the same command will execute as if Botan -as actually installed at \filename{DIR} and not where it really is; or at least -where \filename{botan-config} thinks it really is. I should mention that it +\texttt{--prefix[=DIR]}: If no argument, print the prefix where Botan +is installed (such as \filename{/opt} or \filename{/usr/local}). If an +argument is specified, other options given with the same command will +execute as if Botan as actually installed at \filename{DIR} and not +where it really is; or at least where \filename{botan-config} thinks +it really is. I should mention that it \texttt{--version}: Print the Botan version number. -\texttt{--cflags}: Print options that should be passed to the compiler whenever -a C++ file is compiled. Typically this is used for setting include paths. +\texttt{--cflags}: Print options that should be passed to the compiler +whenever a C++ file is compiled. Typically this is used for setting +include paths. \texttt{--libs}: Print options for which libraries to link to (this includes \texttt{-lbotan}). -Your \filename{Makefile} can run \filename{botan-config} and get the options -necessary for getting your application to compile and link, regardless of -whatever crazy libraries Botan might be linked against. +Your \filename{Makefile} can run \filename{botan-config} and get the +options necessary for getting your application to compile and link, +regardless of whatever crazy libraries Botan might be linked against. \subsection{MS Windows} -No special help exists for building applications on Windows. However, given -that typically Windows software is distributed as binaries, this is less of a -problem - only the developer needs to worry about it. As long as they can -remember where they installed Botan, they just have to set the appropriate -flags in their Makefile/project file. +No special help exists for building applications on Windows. However, +given that typically Windows software is distributed as binaries, this +is less of a problem - only the developer needs to worry about it. As +long as they can remember where they installed Botan, they just have +to set the appropriate flags in their Makefile/project file. \end{document}
0
69
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a8696ac0c6a8a20b1dae79fb0670ea9885767935
Drop todo.txt - moved to http://botan.randombit.net/todo.html
commit a8696ac0c6a8a20b1dae79fb0670ea9885767935 Author: lloyd <[email protected]> Date: Tue Nov 25 06:35:28 2008 +0000 Drop todo.txt - moved to http://botan.randombit.net/todo.html diff --git a/doc/todo.txt b/doc/todo.txt deleted file mode 100644 index e7eb34d88..000000000 --- a/doc/todo.txt +++ /dev/null @@ -1,160 +0,0 @@ - -There are many areas where Botan is deficient. This file documents -some of the more interesting ones. If you're thinking about working on -something within Botan, one of these areas might be a good place to -start. Questions or comments can go to the development mailing list. - -Build System / Porting --------------------- - -The new configure script is fairly flexible in terms of build systems -(though there do remain a few pieces of code tied to the idea of -make-style syntax). No doubt many users would appreciate having Botan -well-integrated into their build environment, so patches to -configure.pl (and new template files for misc/config/makefile/) to add -support for other build systems. The most requested by far is Visual -Studio project files; others that might be of interest would be -autotools, Scons, CMake, and jam/bjam. - -Testing the configure/build/install steps on as many platforms and -compilers as possible is a huge win for us. Builds on some platforms, -like the Motorola 680x0 and Hitachi SH machines, IBM's AIX on any CPU -type, and the Haiku operating system (a BeOS R5 clone) - have *never* -been attempted; the support is based entirely on documentation and -conjecture, and is very unlikely to work. Support for several -operating systems is completely nonexistent - this class includes VMS, -vxWorks, eCos, MINIX, GNU/Hurd, L4, and Coyotos. Others, like IRIX, -HP-UX, QNX, and Tru64, are tested only very rarely. Similarly, many -commercial compilers are only tested occasionally. - -Setting up a buildbot system would be ideal, if access to enough -machines can be arranged (for the x86 and amd64 operating systems, a -single machine running Xen or VMware could suffice). Even one-shot -tests with the latest sources on a variety of machines would be -incredibly useful. - -A nice but not essential feature for configure.pl would be adding the -ability to generate any needed or requested package-building scripts, -with support for systems like rpm, portage, dpkg, commercial Unix -package systems, and Windows installer systems. - -Splitting the build into distinct static and shared targets (and -static-debug and shared-debug) would make certain things much simpler, -as well as being a performance advantage on many systems (in -particular on x86, where losing %ebx for the PIC pointer is a huge -loss) - -Modules to allow use of platform-specific features within Botan can -make life significantly better for users on that platform. Generic -Unix/POSIX support is more or less complete, but there are countless -vendor extensions that might be used in Botan in interesting and -useful ways. Windows has the basics (two entropy source modules, and -modules giving access to mutexes and high resolution timers), but -there are probably a number of interesting extensions one could write, -like making Botan's objects callable by DCOM. Other systems probably -have all kinds of interesting system and library calls we can use. - -Self-test / Benchmark System --------------------- - -The code is not terrible, but it is significantly sloppier than the -library code it is testing. Reporting should be generalized and -encapsulated, so it can easily be extended to produce tests results as -text to the terminal, or HTML with full details, or as an email, or -any of a number of useful formats (which would provide a varying -amount of information about what was tested and what went wrong). -Bonus points for writing a general system that takes in an arbitrary -'template' file and outputs the filled out report. - -Much of the code operates at a very low level of abstraction; this has -caused it to be difficult to add tests that vary much from the simple -known answer tests used for the ciphers and hashes. - -All of the simple functions (rotate_left, get_byte, etc) should be -tested (a failure in one of these causes many failures later, which -are harder to diagnose). - -There are significant codepaths that have no tests written for them, -particularly in the X.509 certificate processing code. - -The benchmark code should also have its output formats generalized; it -would be pretty great to have a benchmark run produce a detailed -report as HTML and some gnuplot datasets to generate the images -included from the HTML file. - -New Memory Allocator --------------------- - -The current pool allocator is serviceable but it can be very wasteful -of memory and could easily be several times faster. Someone who is -interested in algorithms might enjoy working on this. - -Documentation --------------------- - -This could occupy someone for months. Perhaps even a majority of the -API is undocumented, and while these are the less important pieces (or -at least pieces meant mostly for internal library use), it would be -great to have at least a brief description of each of them, along with -a pointer to the appropriate headers. Text written in either a -tutorial style or as a straight API breakdown could easily be -integrated. - -There are many obvious example programs which have yet to be written, -including encrypting a file with a shared passphrase, and securely -salting and hashing a password for storage. Check the mailing list -archives for ideas. - -Public Key Engines --------------------- - -In addition to the fairly low level BigInt optimizations that remain -to be done, Botan provides a plugin system that allows different -implementations of entire algorithms (RSA, DSA, etc) to be included, -which can then be used in a completely transparent manner by -application code. As of this writing one hardware public key -accelerator (AEP's SureWare Runner cards) and two software backends -(GNU MP and OpenSSL's BN library) are supported. There are many others -out there, including Apple's vBigNum AltiVec library, Intel's -Performance Primitives library, OpenBSD's /dev/crypto, and hardware -units like the Broadcom BCM582x and Hi/fn 6500. - -BigInt --------------------- - -The portable BigInt routines are fairly good, and as of 1.6 we're -using reasonably good algorithms. But well written assembly can often -speed up public key operations by 50% or more. There currently exists -some limited x86 and x86-64 assembly, but implementations for other -architectures (such as Cell's SPU units, PowerPC, SPARCv9, MIPS, and -ARM) could really help, as could further work on the x86 code -(including making use of SSE instructions and VIA's Montgomery -multiplication instruction). The key routines for good performance are -bigint_monty_redc and bigint_simple_sqr; together they make up 30-60% -of the runtime of most public key algorithms. - -It is very likely that many of the core algorithms (in src/mp_*) could -be optimized at the C level by anyone has some knowledge or interest -in algorithms. - -Compression Modules --------------------- - -Botan currently supports the bzip2 and zlib compression -formats. Support for gzip and (less importantly) zip would likely be -appreciated by many users. There are also other interesting algorithms -such as LZO (supposedly very fast, which might make it useful in -custom network protocols), and LZW (a compression algorithm patented -by nCipher; they sell hardware implementations). - -X.509 Attribute Certificates --------------------- - -Most of the low-level processing code needed, like support for the -ASN.1 SIGNED macro and the DER/BER codec, have already been written -and used sufficiently to be well tested and relatively easy to work -with. However it involves a lot of careful coding and design work to -deal with the semantic issues and provide a good interface to the -user; at this point I don't have the slightest idea what a useful API -for attribute certificates would be like. RFC 3281 and its references -have most of the information you'll need.
0
94
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
f57b2b3191a054a20e26cd0e5f9a2a1c844ab64e
Add basic docs for TPM API
commit f57b2b3191a054a20e26cd0e5f9a2a1c844ab64e Author: Jack Lloyd <[email protected]> Date: Sat Dec 24 21:53:49 2016 -0500 Add basic docs for TPM API diff --git a/doc/manual/contents.rst b/doc/manual/contents.rst index 2a1136f79..bf70c596e 100644 --- a/doc/manual/contents.rst +++ b/doc/manual/contents.rst @@ -8,6 +8,7 @@ Contents building python cli + versions firststep secmem rng @@ -28,6 +29,6 @@ Contents srp fpe compression - versions ffi pkcs11 + tpm diff --git a/doc/manual/tpm.rst b/doc/manual/tpm.rst new file mode 100644 index 000000000..9f6be8834 --- /dev/null +++ b/doc/manual/tpm.rst @@ -0,0 +1,113 @@ +Trusted Platform Module (TPM) Support +========================================== + +.. versionadded:: 1.11.26 + +Some computers come with a TPM, which is a small side processor which can +perform certain operations which include RSA key generation and signing, a +random number generator, accessing a small amount of NVRAM, and a set of PCRs +which can be used to measure software state (this is TPMs most famous use, for +authenticating a boot sequence). + +The TPM NVRAM and PCR APIs are not supported by Botan at this time, patches welcome. + +Currently only v1.2 TPMs are supported, and the only TPM library supported is +TrouSerS (http://trousers.sourceforge.net/). Hopefully both of these limitations +will be removed in a future release, in order to support newer TPM v2.0 systems. +The current code has been tested with an ST TPM running in a Lenovo laptop. + +Test for TPM support with the macro ``BOTAN_HAS_TPM``, include ``<botan/tpm.h>``. + +First, create a connection to the TPM with a ``TPM_Context``. The context is +passed to all other TPM operations, and should remain alive as long as any other +TPM object which the context was passed to is still alive, otherwise errors or +even an application crash are possible. In the future, the API may change to +using ``shared_ptr`` to remove this problem. + +.. cpp:class:: TPM_Context + + .. cpp:function:: TPM_Context(pin_cb cb, const char* srk_password) + + The PIN callback takes a std::string as an argument, which is + an informative message for the user. It should return a string + containing the PIN entered by the user. + + Normally the SRK password is null. Use nullptr to signal this. + +The TPM contains a RNG of unknown design or quality. If that doesn't scare you +off, you can use it with ``TPM_RNG`` which implements the standard +``RandomNumberGenerator`` interface. + +.. cpp:class:: TPM_RNG + + .. cpp:function:: TPM_RNG(TPM_Context& ctx) + + Initialze a TPM RNG object. After initialization, reading from + this RNG reads from the hardware? RNG on the TPM. + +The v1.2 TPM uses only RSA, but because this key is implemented completely in +hardware it uses a different private key type, with a somewhat different API to +match the TPM's behavior. + +.. cpp:class:: TPM_PrivateKey + + .. cpp:function:: TPM_PrivateKey(TPM_Context& ctx, size_t bits, const char* key_password) + + Create a new RSA key stored on the TPM. The bits should be either 1024 + or 2048; the TPM interface hypothetically allows larger keys but in + practice no v1.2 TPM hardware supports them. + + The TPM processor is not fast, be prepared for this to take a while. + + The key_password is the password to the TPM key ? + + .. cpp:function:: std::string register_key(TPM_Storage_Type storage_type) + + Registers a key with the TPM. The storage_type can be either + `TPM_Storage_Type::User` or `TPM_Storage_Type::System`. If System, the + key is stored on the TPM itself. If User, it is stored on the local hard + drive in a database maintained by an intermediate piece of system + software (which actual interacts with the physical TPM on behalf of any + number of applications calling the TPM API). + + The TPM has only some limited space to store private keys and may reject + requests to store the key. + + In either case the key is encrypted with an RSA key which was generated + on the TPM and which it will not allow to be exported. Thus (so goes the + theory) without physically attacking the TPM + + Returns a UUID which can be passed back to constructor below. + + .. cpp:function:: TPM_PrivateKey(TPM_Context& ctx, const std::string& uuid, \ + TPM_Storage_Type storage_type) + + Load a registered key. The UUID was returned by the ``register_key`` function. + + .. cpp:function:: std::vector<uint8_t> export_blob() const + + Export the key as an encrypted blob. This blob can later be presented + back to the same TPM to load the key. + + .. cpp:function:: TPM_PrivateKey(TPM_Context& ctx, const std::vector<uint8_t>& blob) + + Load a TPM key previously exported as a blob with ``export_blob``. + + .. cpp:function:: std::unique_ptr<Public_Key> public_key() const + + Return the public key associated with this TPM private key. + + TPM does not store public keys, nor does it support signature verification. + + .. cpp:function:: TSS_HKEY handle() const + + Returns the bare TSS key handle. Use if you need to call the raw TSS API. + +A ``TPM_PrivateKey`` can be passed to a ``PK_Signer`` constructor and used to +sign messages just like any other key. Only PKCS #1 v1.5 signatures are supported +by the v1.2 TPM. + +.. cpp:function:: std::vector<std::string> TPM_PrivateKey::registered_keys(TPM_Context& ctx) + + This static function returns the list of all keys (in URL format) + registered with the system
0
48
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c0de1f06d4522f3d1f114fdf2f5566467f495525
Add a sketch of a support roadmap
commit c0de1f06d4522f3d1f114fdf2f5566467f495525 Author: lloyd <[email protected]> Date: Thu Jan 8 13:23:54 2015 +0000 Add a sketch of a support roadmap diff --git a/doc/dev/roadmap.rst b/doc/dev/roadmap.rst new file mode 100644 index 000000000..9c30130e1 --- /dev/null +++ b/doc/dev/roadmap.rst @@ -0,0 +1,59 @@ + +Botan Development Roadmap +======================================== + +Branch Stucture +---------------------------------------- + +Stability of branches is indicated by even or odd minor version numbers. The +minor number of the primary trunk is always odd and devel releases and +snapshots are made directly from it. Every once in a while a new even-numbered +branch is forked. All development continues on the main trunk, with fixes and +occasionally small features backported to the stable branch. Stability of API +and ABI is very important in the stable branches, whereas in trunk ABI changes +happen with no warning and API changes are made whenever it would serve the +ends of justice. + +Current Status +---------------------------------------- + +Currently (as of 2015-01-08) trunk is numbered 1.11 and is written in C++11, +unlike earlier versions which used C++98. In due time a new stable 2.0 branch +will be made off of trunk and afterwards trunk will be renumbered as 2.1. The +2.0 releases will be maintained with security and bug fixes at least until a +new 2.2 stable branch is created and likely for some time afterwards. In the +last decade the length of time between new stable trees being created has been +between 23 and 41 months, suggesting a support lifetime of 2-4 years for 2.0.x. + +The 1.10 stable tree is, well, stable. There isn't enough project time to +backport all of the nice features from 1.11 (eg TLS v1.2, GCM, OCB, or +McEliece) to 1.10, even where it could be done while maintaining API/ABI +compat. The C++11 transition makes it especially hard for the 1.10/1.11 +split. So if 1.10 does what you want now it probably will next week, but it +won't ever do much beyond that. If you want any feature or optimization or side +channel resistance added in the last 4 years you have to use 1.11. 1.10 will +continue to be maintained at the current level for at least a year after 2.0 is +released. + +1.8 and all older versions are no longer maintained. + +Supported Targets +---------------------------------------- + +The primary supported target (ie, what the main developer uses and tests with +regularly) is a recent GCC or Clang on Linux with an x86-64 CPU. Occasionally +Linux systems using POWER, MIPS, and ARM processors are also checked. Testing +and fixes for Windows, MinGW, OS X, OpenBSD, Visual C++, iOS, etc comes +primarily from users. + +Ongoing Issues +---------------------------------------- + +Currently sources are kept in :doc:`Monotone <vcs>`, which likely discourages +some would-be developers. The github mirror may be helping somewhat here. + +Some infrastructure, scripts and such still exists only on the machines of the +primary developer. + +Documentation could always use help. Many things are completely undocumented, +few things are documented well.
0
36
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
63940629afb21e4cbfcbdddb2933fe79e4bef3c3
Updates for 1.7.5, now tentatively planned for tomorrow.
commit 63940629afb21e4cbfcbdddb2933fe79e4bef3c3 Author: lloyd <[email protected]> Date: Sat Apr 12 17:31:55 2008 +0000 Updates for 1.7.5, now tentatively planned for tomorrow. diff --git a/doc/logs/log-17.txt b/doc/logs/log-17.txt index adef98afb..b2de3e258 100644 --- a/doc/logs/log-17.txt +++ b/doc/logs/log-17.txt @@ -1,15 +1,15 @@ -* 1.7.5 - - - Remove the Named_Mutex_Holder. Probably only used internally, it - was known to take up too much time for what it was doing, for a - very small gain in readability. - - - New typedef Pipe::message_id to represent the Pipe message number. - This is currently still a u32bit, but at some point may become an - opaque type that can simply be passed back to the same Pipe. - - - Allow using a std::istream to initialize a DataSource_Stream object. +* 1.7.5, April 13, 2008 + - The API of X509_CA::sign_request was altered to avoid race conditions + - New type Pipe::message_id to represent the Pipe message number + - Remove the Named_Mutex_Holder for a small performance gain + - Removed several unused or rarely used functions from Config + - Ignore spaces inside of a decimal string in BigInt::decode + - Allow using a std::istream to initialize a DataSource_Stream object + - Fix compilation problem in zlib compression module + - The chunk sized used by Pooling_Allocator is now a compile time setting + - The size of random blinding factors is now a compile time setting + - The install target no longer tries to set a particular owner/group * 1.7.4, March 10, 2008 - Use unaligned memory read/writes on systems that allow it, for performance diff --git a/readme.txt b/readme.txt index c6eef310b..5f164b614 100644 --- a/readme.txt +++ b/readme.txt @@ -1,15 +1,14 @@ -Botan 1.7.4 +Botan 1.7.5 (prerelease) http://botan.randombit.net/ Please note that this is an experimental / development version of Botan. Feedback and critical analysis is highly appreciated. There may -be bugs (as always). If this sounds scary, it's recommended you use -the latest stable (1.6) release. +be bugs (as always). APIs may be changed with little or no notice. If +this sounds scary, it's recommended you use the latest stable release +instead. -You can file bugs at http://www.randombit.net/bugzilla +You can file bugs at http://www.randombit.net/bugzilla or by sending +mail to the botan-devel mailing list. For more information, see info.txt, the API manual, and the tutorial, all of which can be found in the doc/ directory. - -Jack -([email protected])
0
46
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
1da16e1fccc364068783d97662cbcb053131e5d6
Update the public key docs
commit 1da16e1fccc364068783d97662cbcb053131e5d6 Author: Jack Lloyd <[email protected]> Date: Fri Mar 24 05:57:26 2023 -0400 Update the public key docs diff --git a/doc/api_ref/kdf.rst b/doc/api_ref/kdf.rst index 7a4fa6b96..01892ddca 100644 --- a/doc/api_ref/kdf.rst +++ b/doc/api_ref/kdf.rst @@ -1,7 +1,7 @@ .. _key_derivation_function: -Key Derivation Functions +Key Derivation Functions (KDF) ======================================== Key derivation functions are used to turn some amount of shared secret diff --git a/doc/api_ref/pubkey.rst b/doc/api_ref/pubkey.rst index be18dbea8..924f6c9d5 100644 --- a/doc/api_ref/pubkey.rst +++ b/doc/api_ref/pubkey.rst @@ -1,28 +1,142 @@ +================================= Public Key Cryptography ================================= -Public key cryptography (also called asymmetric cryptography) is a collection -of techniques allowing for encryption, signatures, and key agreement. +Public key cryptography is a collection of techniques allowing for encryption, +signatures, and key agreement. Key Objects ---------------------------------------- -Public and private keys are represented by classes ``Public_Key`` and it's -subclass ``Private_Key``. The use of inheritance here means that a -``Private_Key`` can be converted into a reference to a public key. +Public and private keys are represented by classes ``Public_Key`` and +``Private_Key``. Both derive from ``Asymmetric_Key``. + +Currently there is an inheritance relationship between ``Private_Key`` and +``Public_Key``, so that a private key can also be used as the cooresponding +public key. It is best to avoid relying on this, as this inheritance will be +removed in a future major release. + +.. cpp:class:: Asymmetric_Key + + .. cpp:function:: std::string algo_name() + + Return a short string identifying the algorithm of this key, + eg "RSA" or "Dilithium". + + .. cpp:function:: size_t estimated_strength() const + + Return an estimate of the strength of this key, in terms of brute force + key search. For example if this function returns 128, then it is is + estimated to be roughly as difficult to crack as AES-128. + + .. cpp:function:: OID object_identifier() const + + Return an object identifier which can be used to identify this + type of key. + + .. cpp:function:: bool supports_operation(PublicKeyOperation op) const + + Check if this key could be used for the queried operation type. + + +.. cpp:class:: Public_Key + + .. cpp:function:: size_t key_length() const = 0; + + Return an integer value that most accurately captures for the security + level of the key. For example for RSA this returns the length of the + public modules, while for ECDSA keys it returns the size of the elliptic + curve group. + + .. cpp:function:: bool check_key(RandomNumberGenerator& rng, bool strong) const = 0; + + Check if the key seems to be valid. If *strong* is set to true then more + expensive tests are performed. + + .. cpp:function:: AlgorithmIdentifier algorithm_identifier() const = 0; + + Return an X.509 algorithm identifier that can be used to identify the key. + + .. cpp:function:: std::vector<uint8_t> public_key_bits() const = 0; + + .. cpp:function:: std::vector<uint8_t> subject_public_key() const; + + Return the X.509 SubjectPublicKeyInfo encoding of this key + + .. cpp:function:: std::string fingerprint_public(const std::string& alg = "SHA-256") const; + + Return a hashed fingerprint of this public key. + +Public Key Algorithms +------------------------ -None of the functions on ``Public_Key`` and ``Private_Key`` itself are -particularly useful for users of the library, because 'bare' public key -operations are *very insecure*. The only purpose of these functions is to -provide a clean interface that higher level operations can be built on. So -really the only thing you need to know is that when a function takes a -reference to a ``Public_Key``, it can take any public key or private key, and -similarly for ``Private_Key``. +Botan includes a number of public key algorithms, some of which are in common +use, others only used in specialized or niche applications. -Types of ``Public_Key`` include ``RSA_PublicKey``, ``DSA_PublicKey``, -``ECDSA_PublicKey``, ``ECKCDSA_PublicKey``, ``ECGDSA_PublicKey``, ``DH_PublicKey``, ``ECDH_PublicKey``, -``Curve25519_PublicKey``, ``ElGamal_PublicKey``, ``McEliece_PublicKey``, ``XMSS_PublicKey`` -and ``GOST_3410_PublicKey``. There are corresponding ``Private_Key`` classes for each of these algorithms. +RSA +~~~~~~ + +Based on the difficulty of factoring. Usable for encryption, signatures, and key encapsulation. + +ECDSA +~~~~~~ + +Fast signature scheme based on elliptic curves. + +ECDH, DH, and X25519 +~~~~~~~~~~~~~~~~~~~~~~~ + +Key agreement schemes. DH uses arithmetic over finite fields and is slower and +with larger keys. ECDH and X25519 use elliptic curves instead. + +Dilithium +~~~~~~~~~~ + +Post-quantum secure signature scheme based on lattice problems. + +Kyber +~~~~~~~~~~~ + +Post-quantum key encapsulation scheme based on lattices. + +Ed25519 +~~~~~~~~~~ + +Signature scheme based on a specific elliptic curve. + +XMSS +~~~~~~~~~ + +A post-quantum secure signature scheme whose security is based (only) on the +security of a hash function. Unfortunately XMSS is stateful, meaning the private +key changes with each signature, and only a certain pre-specified number of +signatures can be created. If the same state is ever used to generate two +signatures, then the whole scheme becomes insecure, and signatures can be +forged. + +McEliece +~~~~~~~~~~ + +Post-quantum secure key encapsulation scheme based on the hardness of certain +decoding problems. + +ElGamal +~~~~~~~~ + +Encryption scheme based on the discrete logarithm problem. Generally unused +except in PGP. + +DSA +~~~~ + +Finite field based signature scheme. A NIST standard but now quite obsolete. + +ECGDSA, ECKCDSA, SM2, GOST-34.10 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A set of signature schemes based on elliptic curves. All are national standards +in their respective countries (Germany, South Korea, China, and Russia, resp), +and are completely obscure and unused outside of that context. .. _creating_new_private_keys: @@ -117,8 +231,9 @@ encrypted storage. PBE, a sensible default will be used. The currently supported PBE is PBES2 from PKCS5. Format is as follows: - ``PBE-PKCS5v20(CIPHER,PBKDF)``. Since 2.8.0, ``PBES2(CIPHER,PBKDF)`` also works. - Cipher can be any block cipher with /CBC or /GCM appended, for example + ``PBE-PKCS5v20(CIPHER,PBKDF)`` or ``PBES2(CIPHER,PBKDF)``. + + Cipher can be any block cipher using CBC or GCM modes, for example "AES-128/CBC" or "Camellia-256/GCM". For best interop with other systems, use AES in CBC mode. The PBKDF can be either the name of a hash function (in which case PBKDF2 is used with that hash) or "Scrypt", which causes the scrypt @@ -133,7 +248,7 @@ encrypted storage. For ciphers you can use anything which has an OID defined for CBC, GCM or SIV modes. Currently this includes AES, Camellia, Serpent, Twofish, and SM4. Most other libraries only support CBC mode for private key encryption. GCM has - been supported in PBES2 since 1.11.10. SIV has been supported since 2.8. + been supported in PBES2 since 2.0. SIV has been supported since 2.8. .. cpp:function:: std::string PKCS8::PEM_encode(const Private_Key& key, \ RandomNumberGenerator& rng, const std::string& pass, const std::string& pbe_algo = "") @@ -189,7 +304,7 @@ thrown. .. _serializing_public_keys: Serializing Public Keys -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +----------------------------- To import and export public keys, use: @@ -197,20 +312,25 @@ To import and export public keys, use: .. cpp:function:: std::string X509::PEM_encode(const Public_Key& key) -.. cpp:function:: Public_Key* X509::load_key(DataSource& in) +.. cpp:function:: std::unique_ptr<Public_Key> X509::load_key(DataSource& in) -.. cpp:function:: Public_Key* X509::load_key(const secure_vector<uint8_t>& buffer) +.. cpp:function:: std::unique_ptr<Public_Key> X509::load_key(const secure_vector<uint8_t>& buffer) -.. cpp:function:: Public_Key* X509::load_key(const std::string& filename) +.. cpp:function:: std::unique_ptr<Public_Key> X509::load_key(const std::string& filename) These functions operate in the same way as the ones described in :ref:`serializing_private_keys`, except that no encryption option is available. +.. note:: + + In versions prior to 3.0, these functions returned a raw pointer instead of a + ``unique_ptr``. + .. _dl_group: DL_Group -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +------------------------------ As described in :ref:`creating_new_private_keys`, a discrete logarithm group can be shared among many keys, even keys created by users who do not trust @@ -272,7 +392,7 @@ You can reload a serialized group using .. cpp:function:: void DL_Group::PEM_decode(DataSource& source) Code Example -""""""""""""""""" +~~~~~~~~~~~~~~~ The example below creates a new 2048 bit ``DL_Group``, prints the generated parameters and ANSI_X9_42 encodes the created group for further usage with DH. @@ -283,7 +403,7 @@ parameters and ANSI_X9_42 encodes the created group for further usage with DH. .. _ec_group: EC_Group -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ An ``EC_Group`` is initialized by passing the name of the group to be used to the constructor. These groups have @@ -320,8 +440,8 @@ loaded key. If the key check fails a respective error is thrown. .. literalinclude:: /../src/examples/check_key.cpp :language: cpp -Encryption ---------------------------------- +Public Key Encryption/Decrpytion +---------------------------------- Safe public key encryption requires the use of a padding scheme which hides the underlying mathematical properties of the algorithm. Additionally, they @@ -332,11 +452,11 @@ The primary interface for encryption is .. cpp:class:: PK_Encryptor - .. cpp:function:: secure_vector<uint8_t> encrypt( \ - const uint8_t* in, size_t length, RandomNumberGenerator& rng) const + .. cpp:function:: std::vector<uint8_t> encrypt( \ + const uint8_t in[], size_t length, RandomNumberGenerator& rng) const - .. cpp:function:: secure_vector<uint8_t> encrypt( \ - const std::vector<uint8_t>& in, RandomNumberGenerator& rng) const + .. cpp:function:: std::vector<uint8_t> encrypt( \ + std::span<const uint8_t> in, RandomNumberGenerator& rng) const These encrypt a message, returning the ciphertext. @@ -346,33 +466,41 @@ The primary interface for encryption is bytes. If you call :cpp:func:`PK_Encryptor::encrypt` with a value larger than this the operation will fail with an exception. -:cpp:class:`PK_Encryptor` is only an interface - to actually encrypt you have -to create an implementation, of which there are currently three available in the + .. cpp:function:: size_t ciphertext_length(size_t ctext_len) const + + Return an upper bound on the returned size of a ciphertext, if this + particular key/padding scheme is used to encrypt a message of the provided + length. + +:cpp:class:`PK_Encryptor` is only an interface - to actually encrypt you have to +create an implementation, of which there are currently three available in the library, :cpp:class:`PK_Encryptor_EME`, :cpp:class:`DLIES_Encryptor` and :cpp:class:`ECIES_Encryptor`. DLIES is a hybrid encryption scheme (from -IEEE 1363) that uses the DH key agreement technique in combination with a KDF, a -MAC and a symmetric encryption algorithm to perform message encryption. ECIES is -similar to DLIES, but uses ECDH for the key agreement. Normally, public key -encryption is done using algorithms which support it directly, such as RSA or -ElGamal; these use the EME class: +IEEE 1363) that uses Diffie-Hellman key agreement technique in combination with +a KDF, a MAC and a symmetric encryption algorithm to perform message +encryption. ECIES is similar to DLIES, but uses ECDH for the key +agreement. Normally, public key encryption is done using algorithms which +support it directly, such as RSA or ElGamal; these use the EME class: .. cpp:class:: PK_Encryptor_EME - .. cpp:function:: PK_Encryptor_EME(const Public_Key& key, std::string eme) + .. cpp:function:: PK_Encryptor_EME(const Public_Key& key, std::string padding) With *key* being the key you want to encrypt messages to. The padding - method to use is specified in *eme*. + method to use is specified in *padding*. - The recommended values for *eme* is "EME1(SHA-1)" or "EME1(SHA-256)". If - you need compatibility with protocols using the PKCS #1 v1.5 standard, - you can also use "EME-PKCS1-v1_5". + If you are not sure what padding to use, use "OAEP(SHA-256)". If you need + compatibility with protocols using the PKCS #1 v1.5 standard, you can also + use "EME-PKCS1-v1_5". .. cpp:class:: DLIES_Encryptor Available in the header ``dlies.h`` .. cpp:function:: DLIES_Encryptor(const DH_PrivateKey& own_priv_key, \ - RandomNumberGenerator& rng, KDF* kdf, MessageAuthenticationCode* mac, \ + RandomNumberGenerator& rng, \ + std::unique_ptr<KDF> kdf, \ + std::unique_ptr<MessageAuthenticationCode> mac, \ size_t mac_key_len = 20) Where *kdf* is a key derivation function (see @@ -381,11 +509,14 @@ ElGamal; these use the EME class: message with a stream of bytes provided by the KDF. .. cpp:function:: DLIES_Encryptor(const DH_PrivateKey& own_priv_key, \ - RandomNumberGenerator& rng, KDF* kdf, Cipher_Mode* cipher, \ - size_t cipher_key_len, MessageAuthenticationCode* mac, \ + RandomNumberGenerator& rng, \ + std::unique_ptr<KDF> kdf, \ + std::unique_ptr<Cipher_Mode> cipher, \ + size_t cipher_key_len, \ + std::unique_ptr<MessageAuthenticationCode> mac, \ size_t mac_key_len = 20) - Instead of XORing the message a block cipher can be specified. + Instead of XORing the message with KDF output, a cipher mode can be used .. cpp:class:: ECIES_Encryptor @@ -414,7 +545,6 @@ The decryption classes are named :cpp:class:`PK_Decryptor`, :cpp:class:`ECIES_Decryptor`. They are created in the exact same way, except they take the private key, and the processing function is named ``decrypt``. - Botan implements the following encryption algorithms and padding schemes: 1. RSA @@ -425,7 +555,7 @@ Botan implements the following encryption algorithms and padding schemes: #. SM2 Code Example -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following Code sample reads a PKCS #8 keypair from the passed location and subsequently encrypts a fixed plaintext with the included public key, using EME1 with SHA-256. For the sake of completeness, the ciphertext is then decrypted using @@ -435,7 +565,7 @@ the private key. :language: cpp -Signatures +Public Key Signature Schemes --------------------------------- Signature generation is performed using @@ -443,100 +573,117 @@ Signature generation is performed using .. cpp:class:: PK_Signer .. cpp:function:: PK_Signer(const Private_Key& key, \ - const std::string& emsa, \ + const std::string& padding, \ Signature_Format format = Siganture_Format::Standard) Constructs a new signer object for the private key *key* using the - signature format *emsa*. The key must support signature operations. In - the current version of the library, this includes RSA, DSA, ECDSA, ECKCDSA, - ECGDSA, GOST 34.10-2001. Other signature schemes may be supported in the future. + hash/padding specified in *padding*. The key must support signature operations. In + the current version of the library, this includes RSA, ECDSA, Dilithium, + ECKCDSA, ECGDSA, GOST 34.10-2001, and SM2. .. note:: Botan both supports non-deterministic and deterministic (as per RFC - 6979) DSA and ECDSA signatures. Deterministic signatures are compatible - in the way that they can be verified with a non-deterministic implementation. - If the ``rfc6979`` module is enabled, deterministic DSA and ECDSA signatures - will be generated. - - Currently available values for *emsa* include EMSA1, EMSA2, EMSA3, EMSA4, - and Raw. All of them, except Raw, take a parameter naming a message - digest function to hash the message with. The Raw encoding signs the - input directly; if the message is too big, the signing operation will - fail. Raw is not useful except in very specialized applications. Examples - are "EMSA1(SHA-1)" and "EMSA4(SHA-256)". - - For RSA, use EMSA4 (also called PSS) unless you need compatibility with - software that uses the older PKCS #1 v1.5 standard, in which case use - EMSA3 (also called "EMSA-PKCS1-v1_5"). For DSA, ECDSA, ECKCDSA, ECGDSA and - GOST 34.10-2001 you should use EMSA1. + 6979) DSA and ECDSA signatures. Either type of signature can be verified + by any other (EC)DSA library, regardless of which mode it prefers. If the + ``rfc6979`` module is enabled at build time, deterministic DSA and ECDSA + signatures will be created. + + The proper value of *padding* depends on the algorithm. For many signature + schemes including ECDSA and DSA, simply naming a hash function like "SHA-256" + is all that is required. + + For RSA, more complicated padding is required. The two most common schemes + for RSA signature padding are PSS and PKCS1v1.5, so you must specify both + the padding mechanism as well as a hash, for example "PSS(SHA-256)" + or "PKCS1v15(SHA-256)". + + Certain newer signature schemes, especially post-quantum based ones, hardcode the + hash function associated with their signatures, and no configuration is + possible. There *padding* should be left blank, or may possibly be used to identify + some algorithm-specific option. For instance Dilithium may be parameterized with + "Randomized" or "Deterministic" to choose if the generated signature is randomized or + not. If left blank, a default is chosen. + + Another available option, usable in certain specialized scenarios, is using + padding scheme "Raw", where the provided input is treated as if it was + already hashed, and directly signed with no other processing. The *format* defaults to ``Standard`` which is either the usual, or the only, available formatting method, depending on the algorithm. For certain - signature schemes including ECDSA, DSA ECGDSA and ECKCDSA you can also use + signature schemes including ECDSA, DSA, ECGDSA and ECKCDSA you can also use ``DerSequence``, which will format the signature as an ASN.1 SEQUENCE - value. + value. This formatting is used in protocols such as TLS and Bitcoin. .. cpp:function:: void update(const uint8_t* in, size_t length) - .. cpp:function:: void update(const std::vector<uint8_t>& in) + .. cpp:function:: void update(std::span<const uint8_t> in) .. cpp:function:: void update(uint8_t in) - These add more data to be included in the signature - computation. Typically, the input will be provided directly to a - hash function. + These add more data to be included in the signature computation. Typically, the + input will be provided directly to a hash function. - .. cpp:function:: secure_vector<uint8_t> signature(RandomNumberGenerator& rng) + .. cpp:function:: std::vector<uint8_t> signature(RandomNumberGenerator& rng) - Creates the signature and returns it + Creates the signature and returns it. The rng may or may not be used, + depending on the scheme. - .. cpp:function:: secure_vector<uint8_t> sign_message( \ + .. cpp:function:: std::vector<uint8_t> sign_message( \ const uint8_t* in, size_t length, RandomNumberGenerator& rng) - .. cpp:function:: secure_vector<uint8_t> sign_message( \ - const std::vector<uint8_t>& in, RandomNumberGenerator& rng) + .. cpp:function:: std::vector<uint8_t> sign_message( \ + std::span<const uint8_t> in, RandomNumberGenerator& rng) + + These functions are equivalent to calling :cpp:func:`PK_Signer::update` and then + :cpp:func:`PK_Signer::signature`. Any data previously provided using ``update`` will + also be included in the signature. + + .. cpp:function:: size_t signature_length() const + + Return an upper bound on the length of the signatures returned by this object. - These functions are equivalent to calling - :cpp:func:`PK_Signer::update` and then - :cpp:func:`PK_Signer::signature`. Any data previously provided - using ``update`` will be included. + .. cpp:function:: AlgorithmIdentifier algorithm_identifier() const + + Return an algorithm identifier appropriate to identify signatures generated + by this object in an X.509 structure. + + .. cpp:function:: std::string hash_function() const + + Return the hash function which is being used Signatures are verified using .. cpp:class:: PK_Verifier .. cpp:function:: PK_Verifier(const Public_Key& pub_key, \ - const std::string& emsa, Signature_Format format = Signature_Format::Standard) + const std::string& padding, Signature_Format format = Signature_Format::Standard) - Construct a new verifier for signatures associated with public - key *pub_key*. The *emsa* and *format* should be the same as - that used by the signer. + Construct a new verifier for signatures associated with public key *pub_key*. The + *padding* and *format* should be the same as that used by the signer. .. cpp:function:: void update(const uint8_t* in, size_t length) - .. cpp:function:: void update(const std::vector<uint8_t>& in) + .. cpp:function:: void update(std::span<const uint8_t> in) .. cpp:function:: void update(uint8_t in) Add further message data that is purportedly associated with the signature that will be checked. .. cpp:function:: bool check_signature(const uint8_t* sig, size_t length) - .. cpp:function:: bool check_signature(const std::vector<uint8_t>& sig) + .. cpp:function:: bool check_signature(std::span<const uint8_t> sig) - Check to see if *sig* is a valid signature for the message data - that was written in. Return true if so. This function clears the - internal message state, so after this call you can call - :cpp:func:`PK_Verifier::update` to start verifying another + Check to see if *sig* is a valid signature for the message data that was written + in. Return true if so. This function clears the internal message state, so after + this call you can call :cpp:func:`PK_Verifier::update` to start verifying another message. .. cpp:function:: bool verify_message(const uint8_t* msg, size_t msg_length, \ const uint8_t* sig, size_t sig_length) - .. cpp:function:: bool verify_message(const std::vector<uint8_t>& msg, \ - const std::vector<uint8_t>& sig) - - These are equivalent to calling :cpp:func:`PK_Verifier::update` - on *msg* and then calling :cpp:func:`PK_Verifier::check_signature` - on *sig*. + .. cpp:function:: bool verify_message(std::span<const uint8_t> msg, \ + std::span<const uint8_t> sig) + These are equivalent to calling :cpp:func:`PK_Verifier::update` on *msg* and then + calling :cpp:func:`PK_Verifier::check_signature` on *sig*. Any data previously + provided to :cpp:func:`PK_Verifier::update` will also be included. Botan implements the following signature algorithms: @@ -548,19 +695,21 @@ Botan implements the following signature algorithms: #. GOST 34.10-2001 #. Ed25519 #. SM2 +#. Dilithium Code Example -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following sample program below demonstrates the generation of a new ECDSA keypair over the curve secp512r1 -and a ECDSA signature using EMSA1 with SHA-256. Subsequently the computed signature is validated. +The following sample program below demonstrates the generation of a new ECDSA keypair over +the curve secp512r1 and a ECDSA signature using SHA-256. Subsequently the computed +signature is validated. .. literalinclude:: /../src/examples/ecdsa.cpp :language: cpp Ed25519 Variants -^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~ Most signature schemes in Botan follow a hash-then-sign paradigm. That is, the entire message is digested to a fixed length representative using a collision @@ -585,62 +734,124 @@ For best interop with other systems, prefer "Ed25519ph". Key Agreement --------------------------------- -You can get a hold of a ``PK_Key_Agreement_Scheme`` object by calling -``get_pk_kas`` with a key that is of a type that supports key -agreement (such as a Diffie-Hellman key stored in a ``DH_PrivateKey`` -object), and the name of a key derivation function. This can be "Raw", -meaning the output of the primitive itself is returned as the key, or -"KDF1(hash)" or "KDF2(hash)" where "hash" is any string you happen to -like (hopefully you like strings like "SHA-256" or "RIPEMD-160"), or -"X9.42-PRF(keywrap)", which uses the PRF specified in ANSI X9.42. It -takes the name or OID of the key wrap algorithm that will be used to -encrypt a content encryption key. - -How key agreement works is that you trade public values with some -other party, and then each of you runs a computation with the other's -value and your key (this should return the same result to both -parties). This computation can be called by using -``derive_key`` with either a byte array/length pair, or a -``secure_vector<uint8_t>`` than holds the public value of the other -party. The last argument to either call is a number that specifies how -long a key you want. - -Depending on the KDF you're using, you *might not* get back a key -of the size you requested. In particular "Raw" will return a number -about the size of the Diffie-Hellman modulus, and KDF1 can only return -a key that is the same size as the output of the hash. KDF2, on the -other hand, will always give you a key exactly as long as you request, -regardless of the underlying hash used with it. The key returned is a -``SymmetricKey``, ready to pass to a block cipher, MAC, or other -symmetric algorithm. - -The public value that should be used can be obtained by calling -``public_data``, which exists for any key that is associated with a -key agreement algorithm. It returns a ``secure_vector<uint8_t>``. - -"KDF2(SHA-256)" is by far the preferred algorithm for key derivation -in new applications. The X9.42 algorithm may be useful in some -circumstances, but unless you need X9.42 compatibility, KDF2 is easier -to use. - - -Botan implements the following key agreement methods: +Key agreement is a scheme where two parties exchange public keys, after which it is +possible for them to derive a secret key which is known only to the two of them. + +There are different approaches possible for key agreement. In many protocols, both parties +generate a new key, exchange public keys, and derive a secret, after which they throw away +their private keys, using them only the once. However this requires the parties to both be +online and able to communicate with each other. + +In other protocols, one of the parties publishes their public key online in some way, and +then it is possible for someone to send encrypted messages to that recipient by generating +a new keypair, performing key exchange with the published public key, and then sending +both the message along with their ephemeral public key. Then the recipient uses the +provided public key along with their private key to complete the key exchange, recover the +shared secret, and decrypt the message. + +Typically the raw output of the key agreement function is not uniformily distributed, +and may not be of an appropriate length to use as a key. To resolve these problems, +key agreement will use a :ref:`key_derivation_function` on the shared secret to +produce an output of the desired length. 1. ECDH over GF(p) Weierstrass curves #. ECDH over x25519 #. DH over prime fields -#. McEliece -#. Kyber + +.. cpp:class:: PK_Key_Agreement + + .. cpp:function:: PK_Key_Agreement(const Private_Key& key, \ + RandomNumberGenerator& rng, \ + const std::string& kdf, \ + const std::string& provider = "") + + Set up to perform key derivation using the given private key and specified KDF. + + .. cpp:function:: SymmetricKey derive_key(size_t key_len, \ + const uint8_t in[], \ + size_t in_len, \ + const uint8_t params[], \ + size_t params_len) const + + .. cpp:function:: SymmetricKey derive_key(size_t key_len, \ + std::span<const uint8_t> in, \ + const uint8_t params[], size_t params_len) const + + .. cpp:function:: SymmetricKey derive_key(size_t key_len, \ + const uint8_t in[], size_t in_len, \ + const std::string& params = "") const + + .. cpp:function:: SymmetricKey derive_key(size_t key_len, \ + const std::span<const uint8_t> in, \ + const std::string& params = "") const + + Return a shared key. The *params* will be hashed along with the shared secret by the + KDF; this can be useful to bind the shared secret to a specific usage. + + The *in* parameter must be the public key associated with the other party. Code Example -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The code below performs an unauthenticated ECDH key agreement using the secp521r elliptic curve and -applies the key derivation function KDF2(SHA-256) with 256 bit output length to the computed shared secret. +The code below performs an unauthenticated ECDH key agreement using the secp521r elliptic +curve and applies the key derivation function KDF2(SHA-256) with 256 bit output length to +the computed shared secret. .. literalinclude:: /../src/examples/ecdh.cpp :language: cpp +Key Encapsulation +------------------- + +Key encapsulation (KEM) is a variation on public key encryption which is commonly used by +post-quantum secure schemes. Instead of choosing a random secret and encrypting it, as in +typical public key encryption, a KEM encryption takes no inputs and produces two values, +the shared secret and the encapulated key. The decryption operation takes in the +encapulated key and returns the shared secret. + +.. cpp:class:: PK_KEM_Encryptor + + .. cpp:function:: PK_KEM_Encryptor(const Public_Key& key, \ + const std::string& kdf = "", \ + const std::string& provider = "") + + Create a KEM encryptor + + .. cpp:function:: void encrypt(secure_vector<uint8_t>& out_encapsulated_key, \ + secure_vector<uint8_t>& out_shared_key, \ + size_t desired_shared_key_len, \ + RandomNumberGenerator& rng, \ + std::span<const uint8_t> salt) + + Perform a key encapsulation operation + +.. cpp:class:: PK_KEM_Decryptor + + .. cpp:function:: PK_KEM_Decryptor(const Public_Key& key, \ + const std::string& kdf = "", \ + const std::string& provider = "") + + Create a KEM decryptor + + .. cpp:function:: secure_vector<uint8> decrypt(std::span<const uint8> encapsulated_key, \ + size_t desired_shared_key_len, \ + std::span<const uint8_t> salt) + + Perform a key decapsulation operation + +Botan implements the following KEM schemes: + +1. RSA +#. Kyber +#. McEliece + +Code Example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The code below demonstrates key encapsulation using the Kyber post-quantum scheme. + +.. literalinclude:: /../src/examples/kyber.cpp + :language: cpp .. _mceliece: @@ -674,28 +885,6 @@ plaintext is represented directly in the ciphertext, with only a small number of bit errors. Thus it is absolutely essential to only use McEliece with a CCA2 secure scheme. -One such scheme, KEM, is provided in Botan currently. It it a somewhat unusual -scheme in that it outputs two values, a symmetric key for use with an AEAD, and -an encrypted key. It does this by choosing a random plaintext (n - log2(n)*t -bits) using ``McEliece_PublicKey::random_plaintext_element``. Then a random -error mask is chosen and the message is coded and masked. The symmetric key is -SHA-512(plaintext || error_mask). As long as the resulting key is used with a -secure AEAD scheme (which can be used for transporting arbitrary amounts of -data), CCA2 security is provided. - -In ``mcies.h`` there are functions for this combination: - -.. cpp:function:: secure_vector<uint8_t> mceies_encrypt(const McEliece_PublicKey& pubkey, \ - const secure_vector<uint8_t>& pt, \ - uint8_t ad[], size_t ad_len, \ - RandomNumberGenerator& rng, \ - const std::string& aead = "AES-256/OCB") - -.. cpp:function:: secure_vector<uint8_t> mceies_decrypt(const McEliece_PrivateKey& privkey, \ - const secure_vector<uint8_t>& ct, \ - uint8_t ad[], size_t ad_len, \ - const std::string& aead = "AES-256/OCB") - For a given security level (SL) a McEliece key would use parameters n and t, and have the corresponding key sizes listed: @@ -749,7 +938,7 @@ for instance will use the SHA2-256 hash function to generate a tree of height ten. Code Example -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following code snippet shows a minimum example on how to create an XMSS public/private key pair and how to use these keys to create and verify a diff --git a/src/examples/ecdsa.cpp b/src/examples/ecdsa.cpp index 7d517d6e4..e26500395 100644 --- a/src/examples/ecdsa.cpp +++ b/src/examples/ecdsa.cpp @@ -14,12 +14,12 @@ int main() { std::string text("This is a tasty burger!"); std::vector<uint8_t> data(text.data(), text.data() + text.length()); // sign data - Botan::PK_Signer signer(key, rng, "EMSA1(SHA-256)"); + Botan::PK_Signer signer(key, rng, "SHA-256"); signer.update(data); std::vector<uint8_t> signature = signer.signature(rng); std::cout << "Signature:" << std::endl << Botan::hex_encode(signature); // verify signature - Botan::PK_Verifier verifier(key, "EMSA1(SHA-256)"); + Botan::PK_Verifier verifier(key, "SHA-256"); verifier.update(data); std::cout << std::endl << "is " << (verifier.check_signature(signature) ? "valid" : "invalid"); return 0; diff --git a/src/examples/kyber.cpp b/src/examples/kyber.cpp new file mode 100644 index 000000000..389e5fa40 --- /dev/null +++ b/src/examples/kyber.cpp @@ -0,0 +1,37 @@ +#include <botan/pubkey.h> +#include <botan/kyber.h> +#include <botan/system_rng.h> +#include <array> +#include <iostream> + +int main() + { + const size_t shared_key_len = 32; + const std::string kdf = "HKDF(SHA-512)"; + + Botan::System_RNG rng; + + std::array<uint8_t, 16> salt; + rng.randomize(salt); + + Botan::Kyber_PrivateKey priv_key(rng, Botan::KyberMode::Kyber512); + auto pub_key = priv_key.public_key(); + + Botan::PK_KEM_Encryptor enc(*pub_key, kdf); + + Botan::secure_vector<uint8_t> encapsulated_key; + Botan::secure_vector<uint8_t> enc_shared_key; + enc.encrypt(encapsulated_key, enc_shared_key, shared_key_len, rng, salt); + + Botan::PK_KEM_Decryptor dec(priv_key, rng, kdf); + + auto dec_shared_key = dec.decrypt(encapsulated_key, shared_key_len, salt); + + if(dec_shared_key != enc_shared_key) + { + std::cerr << "Shared keys differ\n"; + return 1; + } + + return 0; + }
0
75
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a29484c932bb40bd2bdd259718d0699d5e717d1a
Update news [ci skip]
commit a29484c932bb40bd2bdd259718d0699d5e717d1a Author: Jack Lloyd <[email protected]> Date: Mon Dec 18 10:32:02 2017 -0500 Update news [ci skip] diff --git a/news.rst b/news.rst index abd106e83..791ae4977 100644 --- a/news.rst +++ b/news.rst @@ -8,7 +8,7 @@ Version 2.4.0, Not Yet Released ability to disable building the static library. All makefile constructs that were specific to nmake or GNU make have been eliminated, thus the option ``--makefile-style`` which was previously used to select the makefile type has - also been removed. (GH #1230 #1237 #1300 #1318 #1319 #1324 and #1325) + also been removed. (GH #1230 #1237 #1300 #1318 #1319 #1324 #1325 #1346) * Support for negotiating the DH group as specified in RFC 7919 is now available in TLS (GH #1263) @@ -22,19 +22,28 @@ Version 2.4.0, Not Yet Released * Add support for AES key wrapping with padding, as specified in RFC 5649 and NIST SP 800-38F (GH #1301) +* OCSP requests made during certificate verification had the potential to hang + forever. Now the sockets are non-blocking and a timeout is enforced. (GH #1360 + fixing GH #1326) + +* Add ``Public_Key::fingerprint_public`` which allows fingerprinting the public key. + The previously available ``Private_Key::fingerprint`` is deprecated, now + ``Private_Key::fingerprint_private`` should be used if this is required. + (GH #1357) + * XMSS signatures now are multithreaded for improved performance (GH #1267) -* Fix a bug that caused the peer cert list to be empty on a resumed session. +* Fix a bug that caused the TLS peer cert list to be empty on a resumed session. (GH #1303 #1342) * Increase the maximum HMAC key length from 512 bytes to 4096 bytes. This allows - using a DH key exchange with a group greater than 4096 bits. (GH #1316) + using a DH key exchange in TLS with a group greater than 4096 bits. (GH #1316) * Fix a bug in the TLS server where, on receiving an SSLv3 client hello, it would attempt to negotiate TLS v1.2. Now a protocol_version alert is sent. Found with tlsfuzzer. (GH #1316) -* Fix several bugs related to sending the wrong alert type in various error +* Fix several bugs related to sending the wrong TLS alert type in various error scenarious, caught with tlsfuzzer. * Add support for a ``tls_http_server`` command line utility which responds to @@ -54,6 +63,8 @@ Version 2.4.0, Not Yet Released * Salsa20 now supports the seek operation. +* Add ``EC_Group::known_named_groups`` (GH #1339) + * Symmetric algorithms (block ciphers, stream ciphers, MACs) now verify that a key was set before accepting data. Previously attempting to use an unkeyed object would instead result in either a crash or invalid outputs. (GH #1279) @@ -167,6 +178,14 @@ Version 2.4.0, Not Yet Released * Support for NEON is now enabled under Clang. +* Now the compiler version is detected using the preprocessor, instead of trying + to parse the output of the compiler's version string, which was subject to + problems with localization. (GH #1358) + +* By default the gzip compressor will not include a timestamp in the header. + The timestamp can be set by passing it to the ``Gzip_Compression`` + constructor. + * Add an OID for RIPEMD-160 * Fixes for CMake build (GH #1251)
0
76
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
bba595315a9a3b3f024d4a1aed5b8e6fa38a0c56
Update news
commit bba595315a9a3b3f024d4a1aed5b8e6fa38a0c56 Author: Jack Lloyd <[email protected]> Date: Tue Aug 29 07:59:37 2017 -0400 Update news diff --git a/news.rst b/news.rst index 3ef115fdc..fca023b65 100644 --- a/news.rst +++ b/news.rst @@ -44,6 +44,11 @@ Version 2.3.0, Not Yet Released * Silence a Clang warning in create_private_key (GH #1150) +* The fuzzers have been better integrated with the main build. (GH #1158) + +* The Travis CI build is now run via a Python script. This makes it + easier to replicate the behavior of the CI build locally. (GH #1162) + * Fix a bug in FFI tests that caused the test files not to be found when using `--data-dir` option (GH #1149)
0
33
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
8a80c94fc6f9333315f56940ca3a659c18d8825f
Add a comment to BlockCipher mentionining the usefulness of extending it to support multiple blocks.
commit 8a80c94fc6f9333315f56940ca3a659c18d8825f Author: lloyd <[email protected]> Date: Tue Nov 18 17:38:55 2008 +0000 Add a comment to BlockCipher mentionining the usefulness of extending it to support multiple blocks. diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h index a5efcfb38..39ae1aab3 100644 --- a/src/block/block_cipher.h +++ b/src/block/block_cipher.h @@ -12,6 +12,15 @@ namespace Botan { /** * This class represents a block cipher object. +* +* It would be very useful to extend this interface to support the +* encryption of multiple blocks at a time. This could help +* performance, wrt cache effects in the software implementations, and +* could be a big deal when supporting block ciphers implemented as +* hardware devices. It could be used by implementations of ECB, and +* more importantly counter mode (which most designs are moving to, due +* to the parallelism possible in counter mode which is not the case +* with feedback-based modes like CBC). */ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm {
0
55
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
750c58d837be8bc6477b88957d09baff1ba369ae
Update roadmap re 2.0 [ci skip]
commit 750c58d837be8bc6477b88957d09baff1ba369ae Author: Jack Lloyd <[email protected]> Date: Thu Nov 3 15:06:27 2016 -0400 Update roadmap re 2.0 [ci skip] diff --git a/doc/roadmap.rst b/doc/roadmap.rst index 8f213b17f..ccac29a28 100644 --- a/doc/roadmap.rst +++ b/doc/roadmap.rst @@ -2,56 +2,64 @@ Botan Development Roadmap ======================================== -Branch Stucture +Branch Structure ---------------------------------------- Stability of branches is indicated by even or odd minor version numbers. The -minor number of the primary trunk is always odd and devel releases and -snapshots are made directly from it. Every once in a while a new even-numbered -branch is forked. All development continues on the main trunk, with fixes and -occasionally small features backported to the stable branch. Stability of API -and ABI is very important in the stable branches, whereas in trunk ABI changes -happen with no warning, and API changes are made whenever it would serve the -ends of justice. +minor number of master is always odd, and devel releases come from it. Every +once in a while a new even-numbered branch is forked. All development continues +on the main trunk, with fixes and API compatible features backported to the +stable branch. Stability of API and ABI is very important in the stable +branches, whereas in master ABI changes happen with no warning, and API changes +are made whenever it would serve the ends of justice. Current Status ---------------------------------------- -Currently (as of 2015-07-03) trunk is numbered 1.11 and is written in C++11, -unlike earlier versions which used C++98. In due time a new stable 2.0 branch -will be made off of trunk and afterwards trunk will be renumbered as 2.1. The -2.0 releases will be maintained with security and bug fixes at least until a -new 2.2 stable branch is created and likely for some time afterwards. In the -last decade the length of time between new stable trees being created has been -between 23 and 41 months, suggesting a support lifetime of 2-4 years for 2.0.x. - -The 1.10 stable tree is, well, stable. There isn't enough project time to -backport all of the nice features from 1.11 (eg TLS v1.2, GCM, OCB, or -McEliece) to 1.10, even where it could be done while maintaining API/ABI -compat. The C++11 transition makes it especially hard for the 1.10/1.11 -split. So if 1.10 does what you want now it probably will next week, but it -won't ever do much beyond that. If you want any feature or optimization or side -channel resistance added in the last 4 years you have to use 1.11. 1.10 will -continue to be maintained at the current level for 1 year after 2.0 is released. - -1.8 and all older versions are no longer maintained. +Currently (as of 2016-11-03) git master is approaching feature freeze for a +stable 2.0 branch by the end of December 2016. + +At some point between the final release candidate and the 2.0.0 release, a new +release-2.0 branch will be created off of master. Development will continue on +master (renumbered as 2.1.0), with chosen changes backported to release-2.0 +branch. + +Theoretically a new development release could be created at any time after this. +But it is likely that for at least several months after branching, most +development will be oriented towards being applied also to 2.0, and so there +will not be any interesting diff between 2.1 and 2.0. At some point when the +divergence grows enough to be 'interesting' a new development release will be +created. These early development releases would only be for experimenters, with +2.0 recommended for general use. + +Support Lifetimes +---------------------------------------- + +Botan 2.0.x will be supported for at least 24 months from the date of 2.0.0 +(probably longer) + +Botan 1.10.x is supported (for security patches only) through 2017-12-31 + +All prior versions are no longer supported in any way. Supported Targets ---------------------------------------- The primary supported targets, which are tested with every commit by -continous integration, are GCC and Clang on Linux, Clang on OS X, and -MSVC 2013 on Windows, all on some form of x86. +continuous integration, are GCC and Clang on Linux/x86-64, Clang on +OSX/x86-64, and MSVC 2015 on Windows/x86-64. We also test arm, arm64, +and ppc64 builds via GCC cross compilation and qemu emulation, and for +iOS cross-compilation is checked (but the tests are not run). -Other processors, like ARM, MIPS, and POWER processors, and OSes, such -as OpenBSD, MinGW, or iOS are occasionally tested on an ad-hoc basis, -but breakage is somewhat more likely. +Other processors and OSes, like MIPS and OpenBSD, are occasionally +tested on an ad-hoc basis, but breakage is somewhat more likely. + +As a policy we do not support any OS which is not supported by its +original vendor. So for example no consideration whatsoever is given +to supporting such EOLed systems as Windows 2000 or Solaris 2.6. Ongoing Issues ---------------------------------------- -Some infrastructure, scripts and such still exists only on the machines of the -primary developer. - Documentation could always use help. Many things are completely undocumented, few things are documented well.
0
74
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
bc5e1c87093ea71b738066341edf3d0213562cc7
Call out that the NDK/XCode minimum version is floating [ci skip] Closes GH #3494
commit bc5e1c87093ea71b738066341edf3d0213562cc7 Author: Jack Lloyd <[email protected]> Date: Sat Jun 24 07:33:59 2023 -0400 Call out that the NDK/XCode minimum version is floating [ci skip] Closes GH #3494 diff --git a/doc/support.rst b/doc/support.rst index b4cff2df2..1617c137d 100644 --- a/doc/support.rst +++ b/doc/support.rst @@ -26,6 +26,21 @@ For Botan 3, the tier-2 supported platforms are * Linux x86-32, GCC 11 or later * FreeBSD x86-64, Clang 14 or later +.. note:: + + Notice that the minimum version requirements for XCode and NDK is different + from other compilers. With GCC or Clang, we fix the minimum required compiler + version and aim to maintain that support for the entire lifecycle of + Botan 3. In contrast, for XCode and NDK the minimum version is floating; + namely, we will only support the very latest version. It's possible earlier + versions will work, but this is not guaranteed. + +.. note:: + + As of June 2023, it is known that at least XCode 13.3 is required, since + earlier versions did not support certain C++20 language features that the + library uses. XCode 14.2 or higher is recommended. + Some (but not all) of the tier-2 platforms are tested by CI. Everything should work, and if problems are encountered, the developers will probably be able to help. But they are not as carefully tested as tier-1.
0
86
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
0cc8ca3d7b9a09978b92d64c93938134e82c6b5e
Update hacking.rst with copyright info and other hints. GH #331 [ci skip]
commit 0cc8ca3d7b9a09978b92d64c93938134e82c6b5e Author: Jack Lloyd <[email protected]> Date: Mon Nov 16 15:20:20 2015 -0500 Update hacking.rst with copyright info and other hints. GH #331 [ci skip] diff --git a/doc/hacking.rst b/doc/hacking.rst index 3196faa0a..41ec9ca01 100644 --- a/doc/hacking.rst +++ b/doc/hacking.rst @@ -13,7 +13,7 @@ Under `src` there are directories example `build-data/cc/gcc.txt` describes various gcc options. * `scripts` contains various scripts: install, distribution, various codegen things. Scripts controlling CI go under `scripts/ci`. -* `python` and `ocaml` are the FFI bindings for those languages +* `python/botan.py` is the Python ctypes wrapper Library Layout ======================================== @@ -49,16 +49,50 @@ Library Layout * `ffi` is the C99 API * `vendor` contains bindings to external libraries like OpenSSL and Sqlite3 +Copyright Notice +======================================== + +At the top of any new file add a comment with a copyright and +a reference to the license, for examplee:: + + /* + * (C) 2015,2016 Copyright Holder + * Botan is released under the Simplified BSD License (see license.txt) + */ + +If you are making a substantial or non-trivial change to an existing +file, add or update your own copyright statement at the top of the +file. If you are making a change in a new year not covered by your +existing statement, add the year. Even if the years you are making the +change are consecutive, avoid year ranges: specify each year separated +by a comma. + +Also if you are a new contributor or making an addition in a new year, +include an update to `doc/license.txt` in your PR. + Style Conventions ======================================== When writing your code remember the need for it to be easily -understood by reviewers/auditors, both at the time of the patch +understood by reviewers and auditors, both at the time of the patch submission and in the future. Avoid complicated template metaprogramming where possible. It has its places but should be used judiciously. +When designing a new API (for use either by library users or just +internally) try writing out the calling code first. That is, write out +some code calling your idealized API, then just implement that. This +can often help avoid cut-and-paste by creating the correct abstractions +needed to solve the problem at hand. + +The C++11 `auto` keyword is very convenient but only use it when the +type truly is obvious (considering also the potential for unexpected +integer conversions and the like, such as an apparent uint8_t being +promoted to an int). + +Use `override` annotations whenever possible. + A formatting setup for emacs is included in `scripts/indent.el` but the basic formatting style should be obvious. No tabs, and remove trailing whitespace. @@ -73,14 +107,51 @@ this. Sending patches ======================================== -All contributions should be submitted as pull requests via the github page. -If you are planning a large change email the mailing list or open a -discussion ticket on github before starting out. +All contributions should be submitted as pull requests via GitHub +(https://github.com/randombit/botan). If you are planning a large +change email the mailing list or open a discussion ticket on github +before starting out to make sure you are on the right path to +something which we'll be able to accept. + +Depending on what your change is, your PR should probably also include +an update to `doc/news.rst` with a note explaining the change. If your +change is a simple bug fix, a one sentence description is perhaps +sufficient. If there is an existing ticket on GitHub with discussion +or other information, reference it in your change note as 'GH #000'. + +Update `doc/credits.txt` with your information so people know what +you did! (This is optional) If you are interested in contributing but don't know where to start -check out todo.rst for some ideas - these are projects we would almost -certainly accept if the code quality was high. +check out `doc/todo.rst` for some ideas - these are changes we would +almost certainly accept once they've passed code review. Also, try building and testing it on whatever hardware you have handy, especially non-x86 platforms, or especially C++11 compilers other than the regularly tested GCC, Clang, and Visual Studio compilers. + +Build Tools and Hints +======================================== + +If you don't already use it for all your C/C++ development, install +`ccache` now and configure a large cache on a fast disk. It allows for +very quick rebuilds by caching the compiler output. + +Use `--with-sanitizers` to enable ASan. UBSan has to be added separately +with --cc-abi-flags at the moment as GCC 4.8 does not have UBSan. + +Other Ways You Can Help +======================================== + +Convince your employer that the software your company uses and relies on is +worth the time and cost of serious audit. The code may be free, but you are +still using it - so make sure it is any good. Fund code and design reviews +whenever you can of the free software your company relies on, including Botan, +then share the results with the developers to improve the ecosystem for everyone. + +Funding Development +======================================== + +If there is a change you'd like implemented in the library but you'd rather not, +or can't, write it yourself, you can contact Jack Lloyd who in addition to being +the primary author also works as a freelance contractor and security consultant.
0
98
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
e33c989417b7ad9557b02936a1a814e37bf85fcd
Merge GH #520 RNG changes Adds Stateful_RNG base class which handles reseeding after some amount of output (configurable at instantiation time, defaults to the build.h value) as well as detecting forks (just using pid comparisons, so still vulnerable to pid wraparound). Implemented by HMAC_RNG and HMAC_DRBG. I did not update X9.31 since its underlying RNG should already be fork safe and handle reseeding at the appropriate time, since a new block is taken from the underlying RNG (for the datetime vector) for each block of output. Adds RNG::randomize_with_input which for most PRNGs is just a call to add_entropy followed by randomize. However for HMAC_DRBG it is used for additional input. Adds tests for HMAC_DRBG with AD from the CAVS file. RNG::add_entropy is implemented by System_RNG now, as both CryptGenRandom and /dev/urandom support receiving application provided data. The AutoSeeded_RNG underlying type is currently selectable in build.h and defaults to HMAC_DRBG(SHA-256). AutoSeeded_RNG provides additional input with each output request, consisting of the current pid, a counter, and timestamp (unless the application explicitly calls randomize_with_input, in which case we just take what they provided). This is the same hedge used in HMAC_RNGs output PRF. AutoSeeded_RNG is part of the base library now and cannot be compiled out. Removes Entropy_Accumulator type (which just served to bridge between the RNG and the entropy source), instead the Entropy_Source is passed a reference to the RNG being reseeded, and it can call add_entropy on whatever it can come up with.
commit e33c989417b7ad9557b02936a1a814e37bf85fcd Merge: 7438e0b4c 8f2f800c7 Author: Jack Lloyd <[email protected]> Date: Mon Jul 18 15:36:27 2016 -0400 Merge GH #520 RNG changes Adds Stateful_RNG base class which handles reseeding after some amount of output (configurable at instantiation time, defaults to the build.h value) as well as detecting forks (just using pid comparisons, so still vulnerable to pid wraparound). Implemented by HMAC_RNG and HMAC_DRBG. I did not update X9.31 since its underlying RNG should already be fork safe and handle reseeding at the appropriate time, since a new block is taken from the underlying RNG (for the datetime vector) for each block of output. Adds RNG::randomize_with_input which for most PRNGs is just a call to add_entropy followed by randomize. However for HMAC_DRBG it is used for additional input. Adds tests for HMAC_DRBG with AD from the CAVS file. RNG::add_entropy is implemented by System_RNG now, as both CryptGenRandom and /dev/urandom support receiving application provided data. The AutoSeeded_RNG underlying type is currently selectable in build.h and defaults to HMAC_DRBG(SHA-256). AutoSeeded_RNG provides additional input with each output request, consisting of the current pid, a counter, and timestamp (unless the application explicitly calls randomize_with_input, in which case we just take what they provided). This is the same hedge used in HMAC_RNGs output PRF. AutoSeeded_RNG is part of the base library now and cannot be compiled out. Removes Entropy_Accumulator type (which just served to bridge between the RNG and the entropy source), instead the Entropy_Source is passed a reference to the RNG being reseeded, and it can call add_entropy on whatever it can come up with.
0
2
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
0395ad89ca4654ff586d7f80a85a767fd9aa26c7
Drop the CMS readme, not really useful now that it is in-tree
commit 0395ad89ca4654ff586d7f80a85a767fd9aa26c7 Author: lloyd <[email protected]> Date: Sat Jul 22 05:39:45 2006 +0000 Drop the CMS readme, not really useful now that it is in-tree diff --git a/misc/cms/readme.txt b/misc/cms/readme.txt deleted file mode 100644 index b4a0afad0..000000000 --- a/misc/cms/readme.txt +++ /dev/null @@ -1,24 +0,0 @@ -Botan CMS alpha1 -December 12, 2003 - -To use this, download a recent version of Botan (1.2.8 or 1.3.7 are best), and -move the source files to src/, the headers to include/ and then run -configure/make as normal. You will then have a CMS encoder/decoder. There are a -couple of testing apps in testing/ which should show the general idea. Lots of -it is unimplemented (which it will tell you by throwing exceptions), but basic -RSA encryption/signatures and a few other things work OK. The encoder is much -more complete than the decoder. - -The encoder works by initializing it with some bits, then calling some number -of operations on it (compress(), digest(), encrypt(), etc) which successfully -'envelope' the data. The decoder works exactly the same, except backwards. (Of -course!) - -This was supposed to have been finished by now, but it's kind of stalled. I -want CMS support, I just don't really want to code it. So I've been occupying -myself with various distractions. I'll probably finish it *someday*. - -If someone out there really wants this soon, and is willing to pay some nominal -consulting fee (we're talking cheap), let me know and we can talk about -it. I think I need some external motivation of some sort to force me to tell -with the mess that is CMS.
0
92
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
b25aafa41385b3521c5157a01e0a33828eed3269
Update news
commit b25aafa41385b3521c5157a01e0a33828eed3269 Author: Jack Lloyd <[email protected]> Date: Sun Jul 5 14:05:46 2020 -0400 Update news diff --git a/doc/security.rst b/doc/security.rst index e2e736a91..3a2059879 100644 --- a/doc/security.rst +++ b/doc/security.rst @@ -18,6 +18,19 @@ https://keybase.io/jacklloyd and on most PGP keyservers. 2020 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* 2020-07-05: Failure to enforce name constraints on alternative names + + The path validation algorithm enforced name constraints on the primary DN + included in the certificate but failed to do so against alternative DNs which + may be included in the subject alternative name. This would allow a corrupted + sub-CA which was constrained by a name constraints extension in its own + certificate to issue a certificate containing a prohibited DN. Until 2.15.0, + there was no API to access these alternative name DNs so it is unlikely that + any application would make incorrect access control decisions on the basis of + the incorrect DN. Reported by Mario Korth of Ruhr-Universität Bochum. + + Introduced in 1.11.29, fixed in 2.15.0 + * 2020-03-24: Side channel during CBC padding The CBC padding operations were not constant time and as a result would leak diff --git a/news.rst b/news.rst index d69897a76..4e5a71ee3 100644 --- a/news.rst +++ b/news.rst @@ -4,10 +4,32 @@ Release Notes Version 2.15.0, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* Fix a bug where the name constraint extension did not constrain the + alternative DN field which can be included in a subject alternative name. This + would allow a corrupted sub-CA which was otherwise constrained by a name + constraint to issue a certificate with a prohibited DN. + +* Fix a bug in the TLS server during client authentication where where + if a (disabled by default) static RSA ciphersuite was selected, then + no certificate request would be sent. This would have an equivalent + effect to a client which simply replied with an empty Certificate + message. (GH #2367) + * Replace the T-Tables implementation of AES with a 32-bit bitsliced version. As a result AES is now constant time on all processors. (GH #2346 #2348 #2353 #2329 #2355) +* In TLS, enforce that the key usage given in the server certificate + allows the operation being performed in the ciphersuite. (GH #2367) + +* In X.509 certificates, verify that the algorithm parameters are + the expected NULL or empty. (GH #2367) + +* Change the HMAC key schedule to attempt to reduce the information + leaked from the key schedule with regards to the length of the key, + as this is at times (as for example in PBKDF2) sensitive information. + (GH #2362) + * Add Processor_RNG which wraps RDRAND or the POWER DARN RNG instructions. The previous RDRAND_RNG interface is deprecated. (GH #2352) @@ -25,6 +47,8 @@ Version 2.15.0, Not Yet Released * When building documentation using Sphinx avoid parallel builds with version 3.0 due to a bug in that version (GH #2326 #2324) +* Fix a memory leak in the CommonCrypto block cipher calls (GH #2371) + * Fix a flaky test that would occasionally fail when running the tests with a large number of threads. (GH #2325 #2197)
0
20
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
956e0716a598824b050fc5c0d6551b6e85466e85
Add a list of mistakes
commit 956e0716a598824b050fc5c0d6551b6e85466e85 Author: Jack Lloyd <[email protected]> Date: Mon Jan 21 08:29:51 2019 -0500 Add a list of mistakes diff --git a/doc/mistakes.rst b/doc/mistakes.rst new file mode 100644 index 000000000..662aa8b81 --- /dev/null +++ b/doc/mistakes.rst @@ -0,0 +1,50 @@ + +These are mistakes made early on in the project's history which are difficult to +fix now, but mentioned in the hope they may serve as an example for others. + +C++ API +--------- + +As an implementation language, I still think C++ is the best choice (or at least +the best choice available in early '00s) at offering good performance, +reasonable abstractions, and low overhead. But the user API should have been +pure C with opaque structs (rather like the FFI layer, which was added much +later). Then an expressive C++ API could be built on top of the C API. This +would have given us a stable ABI, allowed C applications to use the library, and +(these days) make it easier to progressively rewrite the library in Rust. + +Exceptions +----------- + +Constant ABI headaches from this, and it impacts performance and makes APIs +harder to understand. Should have been handled with a result<> type instead. + +Virtual inheritence +--------------------- + +This was used in the public key interfaces and the hierarchy is a tangle. +Public and private keys should be distinct classes, with a function on private +keys that creates a new object cooresponding to the public key. + +Cipher Interface +------------------ + +The cipher interface taking a secure_vector that it reads from and writes to was +an artifact of an earlier design which supported both compression and encryption +in a single API. But it leads to inefficient copies. + +(I am hoping this issue can be somewhat fixed by introducing a new cipher API +and implementing the old API in terms of the new one.) + +Pipe Interface +---------------- + +On the surface this API seems very convenient and easy to use. And it is. But +the downside is it makes the application code totally opaque; some bytes go into +a Pipe object and then come out the end transformed in some way. What happens in +between? Unless the Pipe was built in the same function and you can see the +parameters to the constructor, there is no way to find out. + +The problems with the Pipe API are documented, and it is no longer used within +the library itself. But since many people seem to like it and many applications +use it, we are stuck at least with maintaining it as it currently exists.
0
42
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a5646619a895ac6f11257e4ad154a6b5b2cac2d0
s/--enable-module-sets/--use-module-set/ - otherwise one has to type all of --enable-modules for it to be recognized
commit a5646619a895ac6f11257e4ad154a6b5b2cac2d0 Author: lloyd <[email protected]> Date: Tue Sep 30 22:51:22 2008 +0000 s/--enable-module-sets/--use-module-set/ - otherwise one has to type all of --enable-modules for it to be recognized diff --git a/configure.pl b/configure.pl index 49710eb6a..a4b6d060c 100755 --- a/configure.pl +++ b/configure.pl @@ -676,7 +676,7 @@ sub get_options { 'enable-modules=s' => sub { add_modules($config, $_[1]); }, 'disable-modules=s' => sub { disable_modules($config, $_[1]); }, - 'enable-module-sets=s' => sub { add_module_sets($config, $_[1]); }, + 'use-module-set=s' => sub { add_module_sets($config, $_[1]); }, 'with-build-dir=s' => sub { $$config{'build-dir'} = $_[1]; }, 'with-endian=s' => sub { &$save_option(@_); },
0
8
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
e788f117bc34b86237586aeb3abb53c116c24be4
Mark the es_unix module as not being available on FreeBSD; on FreeBSD 6.1 the module doesn't build due to what appears to be a libc bug.
commit e788f117bc34b86237586aeb3abb53c116c24be4 Author: lloyd <[email protected]> Date: Sun May 28 18:32:37 2006 +0000 Mark the es_unix module as not being available on FreeBSD; on FreeBSD 6.1 the module doesn't build due to what appears to be a libc bug. diff --git a/modules/es_unix/modinfo.txt b/modules/es_unix/modinfo.txt index 94d922c05..e38909e36 100644 --- a/modules/es_unix/modinfo.txt +++ b/modules/es_unix/modinfo.txt @@ -14,7 +14,7 @@ aix beos cygwin darwin -freebsd +#freebsd hpux irix linux
0
12
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
aaf7af95d54dd015a6649f5bdf32e3746a6ac1c2
Merge pull request #218 from webmaster128/module-not-found Make 'module not found' an error
commit aaf7af95d54dd015a6649f5bdf32e3746a6ac1c2 Merge: 0cc314515 6af074f31 Author: Simon Warta <[email protected]> Date: Thu Jul 23 19:03:20 2015 +0200 Merge pull request #218 from webmaster128/module-not-found Make 'module not found' an error
0
3
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
4a94c35f8c9b73666a53a14a9b0a2ee50a742e89
Streamline readme.txt
commit 4a94c35f8c9b73666a53a14a9b0a2ee50a742e89 Author: lloyd <[email protected]> Date: Fri Nov 27 20:03:39 2009 +0000 Streamline readme.txt diff --git a/readme.txt b/readme.txt index 5f729b436..55c5452ea 100644 --- a/readme.txt +++ b/readme.txt @@ -3,19 +3,13 @@ Botan 1.9.4-dev, ????-??-?? Botan is a C++ class library for performing a wide variety of cryptographic operations. -I consider this release the best version available, and recommend all -users upgrade from 1.6 or earlier versions as soon as possible. Some -APIs have changed incompatibly since the 1.6 release series, but most -applications should work as-is or with only simple modifications. - -Botan is under a BSD-like license, the details of which can be found -in license.txt. More information about the authors and contributors -can be found in credits.txt and thanks.txt. All of these files are -included in the doc/ directory of the source distribution. - -You can file bugs in Bugzilla, which can be accessed at - http://www.randombit.net/bugzilla/ -or by sending a report to the botan-devel mailing list +Botan is released under the BSD license. See license.txt for the +specifics. More information about the authors and contributors can be +found in credits.txt and thanks.txt. All of these files are included +in the doc/ directory of the source distribution. + +You can file bugs at http://bugs.randombit.net/ or by sending a report +to the botan-devel mailing list: http://lists.randombit.net/mailman/listinfo/botan-devel/ In the doc directory, there should be a set of PDFs, including @@ -34,10 +28,10 @@ Botan in: - Ajisai (SSLv3/TLSv1) http://www.randombit.net/code/ajisai/ -Check the project's website at http://botan.randombit.net/ for -announcements and new releases. If you'll be developing code using -this library, consider joining the mailing lists to keep up to date -with changes and new releases. +Check http://botan.randombit.net/ for announcements and new +releases. If you'll be developing code using this library, consider +joining the mailing lists to keep up to date with changes and new +releases. As always, feel free to contact me with any questions or comments.
0
51
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
8758cc592f01050f13618c24491acc86f36fc874
Add 1.10.6 release notes
commit 8758cc592f01050f13618c24491acc86f36fc874 Author: lloyd <[email protected]> Date: Sun Nov 10 16:12:49 2013 +0000 Add 1.10.6 release notes diff --git a/doc/relnotes/1_10_6.rst b/doc/relnotes/1_10_6.rst new file mode 100644 index 000000000..241ab801c --- /dev/null +++ b/doc/relnotes/1_10_6.rst @@ -0,0 +1,47 @@ +Version 1.10.6, 2013-11-10 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* The device reading entropy source now attempts to read from all + available devices. Previously it would break out early if a partial + read from a blocking source occured, not continuing to read from a + non-blocking device. This would cause the library to fall back on + slower and less reliable techniques for collecting PRNG seed + material. Reported by Rickard Bellgrim. + +* HMAC_RNG (the default PRNG implementation) now automatically reseeds + itself periodically. Previously reseeds only occured on explicit + application request. + +* Fix an encoding error in EC_Group when encoding using EC_DOMPAR_ENC_OID. + Reported by fxdupont on github. + +* In EMSA2 and Randpool, avoid calling name() on objects after deleting them if + the provided algorithm objects are not suitable for use. Found by Clang + analyzer, reported by Jeffrey Walton. + +* If X509_Store was copied, the u32bit containing how long to cache validation + results was not initialized, potentially causing results to be cached for + significant amounts of time. This could allow a certificate to be considered + valid after its issuing CA's cert expired. Expiration of the end-entity cert + is always checked, and reading a CRL always causes the status to be reset, so + this issue does not affect revocation. Found by Coverity scanner. + +* Avoid off by one causing a potentially unterminated string to be passed to + the connect system call if the library was configured to use a very long path + name for the EGD socket. Found by Coverity Scanner. + +* In PK_Encryptor_EME, PK_Decryptor_EME, PK_Verifier, and PK_Key_Agreement, + avoid dereferencing an unitialized pointer if no engine supported operations + on the key object given. Found by Coverity scanner. + +* Avoid leaking a file descriptor in the /dev/random and EGD entropy sources if + stdin (file descriptor 0) was closed. Found by Coverity scanner. + +* Avoid a potentially undefined operation in the bit rotation operations. Not + known to have caused problems under any existing compiler, but might have + caused problems in the future. Caught by Clang sanitizer, reported by Jeffrey + Walton. + +* Increase default hash iterations from 10000 to 50000 in PBES1 and PBES2 + +* Add a fix for mips64el builds from Brad Smith. diff --git a/doc/relnotes/index.rst b/doc/relnotes/index.rst index c905796ba..83bde48b0 100644 --- a/doc/relnotes/index.rst +++ b/doc/relnotes/index.rst @@ -8,6 +8,7 @@ Series 1.11 .. toctree:: :maxdepth: 1 + 1_11_5 1_11_4 1_11_3 1_11_2 @@ -19,6 +20,7 @@ Series 1.10 .. toctree:: + 1_10_6 1_10_5 1_10_4 1_10_3
0
53
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
db50519bf651c5e1d1787fff374ea2a4632ff013
Add ability for one module to require another. Does not take into account OS/arch/compiler restrictions on the required module, only on the requiree. Since normally the required module will use a subset of the functionality, that is probably OK, but something to be aware of.
commit db50519bf651c5e1d1787fff374ea2a4632ff013 Author: lloyd <[email protected]> Date: Tue Jun 17 14:37:52 2008 +0000 Add ability for one module to require another. Does not take into account OS/arch/compiler restrictions on the required module, only on the requiree. Since normally the required module will use a subset of the functionality, that is probably OK, but something to be aware of. diff --git a/configure.pl b/configure.pl index 6b9b9b71a..66ca7f8ca 100755 --- a/configure.pl +++ b/configure.pl @@ -943,6 +943,16 @@ sub load_modules { foreach my $mod (sort keys %{$$config{'modules'}}) { load_module($config, $mod); + + foreach my $req_mod (@{$MODULES{$mod}{'requires'}}) { + unless(defined($$config{'modules'}{$req_mod})) { + autoconfig("Module $req_mod - required by $mod"); + $$config{'modules'}{$req_mod} = 1; + load_module($config, $req_mod); + } + } + + } my $gen_defines = sub { @@ -1317,6 +1327,7 @@ sub get_module_info { read_list($_, $reader, 'add', list_push(\@{$info{'add'}})); read_list($_, $reader, 'replace', list_push(\@{$info{'replace'}})); read_list($_, $reader, 'ignore', list_push(\@{$info{'ignore'}})); + read_list($_, $reader, 'requires', list_push(\@{$info{'requires'}})); read_list($_, $reader, 'libs', sub {
0
37
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
ef4aea47f25323abfc8fd47e0b1cfe2f13a912c5
Update relnotes and todo, fix python signature
commit ef4aea47f25323abfc8fd47e0b1cfe2f13a912c5 Author: lloyd <[email protected]> Date: Thu Feb 19 23:39:00 2015 +0000 Update relnotes and todo, fix python signature diff --git a/doc/dev/todo.rst b/doc/dev/todo.rst index ae1853dbf..223c50bbb 100644 --- a/doc/dev/todo.rst +++ b/doc/dev/todo.rst @@ -5,13 +5,16 @@ These are features either requested by users or that seem like potentially useful things to have. Several are quite self-contained and could make a quick project. -Request a new feature by sending a patch. +Request a new feature by sending a patch to this file or by writing to +the mailing list. Basic Crypto ---------------------------------------- +* Bitsliced AES or Camellia +* Serpent using AVX2 * scrypt -* BLAKE2 +* BLAKE2b * EdDSA * Skein-MAC * ARIA (Korean block cipher, RFCs 5794 and 6209) @@ -36,18 +39,20 @@ PKIX * OCSP responder logic * X.509 attribute certificates (RFC 5755) -ECC / BigInt / Math +Public Key Crypto, Math, Algorithms ---------------------------------------- -* Specialized reductions for P-256 and P-384 -* MP asm optimizations - SSE2, ARM/NEON, ... +* Add specialized reductions for P-256 and P-384 +* Optimizations for BigInt using SSE2, ARM/NEON, AVX2, ... +* Fast new implementations/algorithms for ECC point operations, + Montgomery multiplication, multi-exponentiation, ... New Protocols ---------------------------------------- * Off-The-Record message protocol * Some useful subset of OpenPGP -* SSHv2 server +* SSHv2 client and/or server * Cash schemes (such as Lucre, credlib, bitcoin?) Accelerators / backends @@ -60,7 +65,12 @@ Accelerators / backends * ARMv8 crypto extensions * Intel Skylake SHA-1/SHA-2 -Python +Python/FFI ---------------------------------------- -* TLS, ECDSA, bcrypt, ... +* Expose TLS + +Build +---------------------------------------- + +* Code signing for Windows installers diff --git a/doc/manual/python.rst b/doc/manual/python.rst index a1239253b..295caa3c3 100644 --- a/doc/manual/python.rst +++ b/doc/manual/python.rst @@ -202,7 +202,7 @@ Public Key Public Key Operations ---------------------------------------- -.. py:class:: pk_op_encrypt(pubkey, padding, rng) +.. py:class:: pk_op_encrypt(pubkey, padding) .. py:method:: encrypt(msg, rng) diff --git a/doc/relnotes/1_11_14.rst b/doc/relnotes/1_11_14.rst index 008d2e795..88c14b444 100644 --- a/doc/relnotes/1_11_14.rst +++ b/doc/relnotes/1_11_14.rst @@ -1,35 +1,49 @@ Version 1.11.14, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* The global state object previously used by the library has been - removed and no form of initialization is required to use the library. - LibraryInitializer remains as a stub. - -* The new `ffi` submodule provides a simple C API/ABI for a number of - useful operations (hashing, ciphers, public key operations, etc) - which is easily accessed using the FFI modules included in many - languages. A new Python wrapper using the Python `ctypes` module - is available. The old Boost.Python wrapper has been removed. - -* OCB mode, which provides a fast and constant time AEAD mode without - requiring hardware support, is now supported in TLS, following - draft-zauner-tls-aes-ocb-01. Because this specification is not yet - finalized is not yet enabled by the default policy, and the - ciphersuite numbers used are in the experimental range and may - conflict with other uses. +* The global state object previously used by the library has been removed and no + form of initialization is required to use the library. The global PRNG has + also been removed. LibraryInitializer remains as a stub. + + The engine code has also been removed, replaced by a much lighter-weight + object registry system which provides lookups in faster time and with less + memory overhead than the previous approach. + +* The new `ffi` submodule provides a simple C API/ABI for a number of useful + operations (hashing, ciphers, public key operations, etc) which is easily + accessed using the FFI modules included in many languages. A new Python + wrapper using the Python `ctypes` module is available. The old Boost.Python + wrapper has been removed. + +* PBKDF and KDF operations now provide a way to write the desired output + directly to an application-specified area rather than always allocating a new + heap buffer. + +* HKDF, previously provided using a non-standard interface, now uses the + standard KDF interface and is retreivable using get_kdf. + +* OCB mode, which provides a fast and constant time AEAD mode without requiring + hardware support, is now supported in TLS, following + draft-zauner-tls-aes-ocb-01. Because this specification is not yet finalized + is not yet enabled by the default policy, and the ciphersuite numbers used are + in the experimental range and may conflict with other uses. + +* Add ability to read TLS policy from text file + +* Remove use of memset_s which caused problems with amalgamation on OS X. + Github 42, 45 * The memory usage of the counter mode implementation has been reduced. -* The memory allocator available on Unix systems which uses mmap and - mlock to lock a pool of memory now checks an environment variable - BOTAN_MLOCK_POOL_SIZE. If this is set to a smaller value then the - library would originally have allocated the user specified size is - used. You can also set it to zero to disable the pool entirely. - Previously the allocator would consume all available mlocked memory, - this allows botan to coexist with an application which wants to - mlock memory of its own. - -* The botan-config script previously installed on Unix systems has - been removed. Its functionality is replaced by the `config` command - of the `botan` tool executable, for example `botan config cflags` - instead of `botan-config --cflags`. +* The memory allocator available on Unix systems which uses mmap and mlock to + lock a pool of memory now checks an environment variable + BOTAN_MLOCK_POOL_SIZE. If this is set to a smaller value then the library + would originally have allocated the user specified size is used. You can also + set it to zero to disable the pool entirely. Previously the allocator would + consume all available mlocked memory, this allows botan to coexist with an + application which wants to mlock memory of its own. + +* The botan-config script previously installed on Unix systems has been + removed. Its functionality is replaced by the `config` command of the `botan` + tool executable, for example `botan config cflags` instead of `botan-config + --cflags`.
0
30
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
4b6b6912cc5c0381790a2232b5580e32689f28a2
Update news
commit 4b6b6912cc5c0381790a2232b5580e32689f28a2 Author: Jack Lloyd <[email protected]> Date: Sat Mar 17 12:27:20 2018 -0400 Update news diff --git a/news.rst b/news.rst index 30ae55427..b663fbd60 100644 --- a/news.rst +++ b/news.rst @@ -70,6 +70,13 @@ Version 2.5.0, Not Yet Released * Remove use of CPU specific optimization flags, instead the user should set these via CXXFLAGS if desired. (GH #1392) +* Resolve an issue that would cause a crash in the tests if they were run on + a machine without SSE2/NEON/VMX instructions. (GH #1495) + +* The Python module now tries to load DLLs from a list of names and + uses the first one which successfully loads and indicates it + supports the desired API level. (GH #1497) + * Various minor optimizations for SHA-3 (GH #1433 #1434) * The output of ``botan --help`` has been improved (GH #1387)
0
54
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
d949a66e68e47afa539b0aac24f7d2783aaf6248
FIX: outdated documentation The 'tls' module is now merely an internal base module for tls12 and tls13.
commit d949a66e68e47afa539b0aac24f7d2783aaf6248 Author: René Meusel <[email protected]> Date: Wed Feb 12 09:14:05 2025 +0100 FIX: outdated documentation The 'tls' module is now merely an internal base module for tls12 and tls13. diff --git a/doc/building.rst b/doc/building.rst index 92a07f33f..a2feb1a06 100644 --- a/doc/building.rst +++ b/doc/building.rst @@ -1029,7 +1029,7 @@ disables modules prohibited by a text policy in ``src/build-data/policy``. Additional modules can be enabled if not prohibited by the policy. Currently available policies include ``bsi``, ``nist`` and ``modern``:: - $ ./configure.py --module-policy=bsi --enable-modules=tls,xts + $ ./configure.py --module-policy=bsi --enable-modules=tls13_pqc,xts ``--enable-modules=MODS`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0
41
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
55aca8017a87f0de61372c89196373872e54edd9
Initial 1.11.2 release notes
commit 55aca8017a87f0de61372c89196373872e54edd9 Author: lloyd <[email protected]> Date: Wed Jan 9 04:56:55 2013 +0000 Initial 1.11.2 release notes diff --git a/doc/relnotes/1_11_2.rst b/doc/relnotes/1_11_2.rst index cc23184e8..c894e0754 100644 --- a/doc/relnotes/1_11_2.rst +++ b/doc/relnotes/1_11_2.rst @@ -1,2 +1,23 @@ Version 1.11.2, Not Yet Released ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Previously `clear_mem` was implemented by an inlined call to + `std::memset`. However an optimizing compiler might notice cases + where the memset could be skipped in cases allowed by the standard. + Now `clear_mem` calls `zero_mem` which is compiled separately and + which zeros out the array through a volatile pointer. It is possible + some compiler with some optimization setting (especially with + something like LTO) might still skip the writes. It would be nice if + there was an automated way to test this. + +* The API of `Credentials_Manager::trusted_certificate_authorities` + has changed to return a vector of `Certificate_Store*` instead of + `X509_Certificate`. This allows the list of trusted CAs to be + more easily updated dynamically or loaded lazily. + +* A bug in the release script caused the `botan_version.py` included + in :doc:`1.11.1 <1_11_1>` to be invalid, which required a manual + edit to fix (:pr:`226`) + +* The `asn1_int.h` header was split into `asn1_alt_name.h`, + `asn1_attribute.h` and `asn1_time.h`.
0
77
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
f7bf9ee4adbbd3f043c32265c2234597e15e8803
configure: Remove duplicates from generated module list I ran into this after PKCS11 was enabled by default, as my local build script uses --enable-modules=pkcs11,... this ended up causing the module to be loaded twice! The result was duplicate entries in the Makefile. Would be good for configure to be written more defensively, the result of this error being a bogus Makefile is lame.
commit f7bf9ee4adbbd3f043c32265c2234597e15e8803 Author: Jack Lloyd <[email protected]> Date: Thu Jan 12 20:30:35 2017 -0500 configure: Remove duplicates from generated module list I ran into this after PKCS11 was enabled by default, as my local build script uses --enable-modules=pkcs11,... this ended up causing the module to be loaded twice! The result was duplicate entries in the Makefile. Would be good for configure to be written more defensively, the result of this error being a bogus Makefile is lame. diff --git a/configure.py b/configure.py index 35f9f7224..523a4ce58 100755 --- a/configure.py +++ b/configure.py @@ -1807,7 +1807,8 @@ def choose_modules_to_use(modules, module_policy, archinfo, ccinfo, options): if modules[mod].warning: logging.warning('%s: %s' % (mod, modules[mod].warning)) - to_load.sort() + # force through set to dedup if required + to_load = sorted(list(set(to_load))) logging.info('Loading modules %s', ' '.join(to_load)) return to_load
0
17
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
4b8e4064aaebd138393c0323878ceabe1f02f250
Doc: clarify definition of 'Internal' modules
commit 4b8e4064aaebd138393c0323878ceabe1f02f250 Author: René Meusel <[email protected]> Date: Wed Jul 31 15:18:32 2024 +0200 Doc: clarify definition of 'Internal' modules diff --git a/doc/dev_ref/configure.rst b/doc/dev_ref/configure.rst index f9f850b51..53197ec1a 100644 --- a/doc/dev_ref/configure.rst +++ b/doc/dev_ref/configure.rst @@ -208,8 +208,10 @@ Maps: * ``Public`` Library users can directly interact with this module. E.g. they may enable or disable the module at will during build. - * ``Internal`` Library users must not directly interact with this module. - It is enabled and used as required by other modules. + * ``Internal`` Library users cannot directly interact with this module. + Typically, it does not expose any public API and is enabled as a + dependency of other modules. Explicitly disabling an internal module + explicitly disables all dependent modules. * ``Virtual`` This module does not contain any implementation but acts as a container for other sub-modules. It cannot be interacted with by the library user and cannot be depended upon directly.
0
23
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
2222759d37d2054ab9a77e721ef8cf33f8c4f941
Document the EC support situation in 3.7.0 In configure.py allow the user to explicitly override an otherwise disabled-due-to-deprecation module.
commit 2222759d37d2054ab9a77e721ef8cf33f8c4f941 Author: Jack Lloyd <[email protected]> Date: Thu Jan 30 18:50:02 2025 -0500 Document the EC support situation in 3.7.0 In configure.py allow the user to explicitly override an otherwise disabled-due-to-deprecation module. diff --git a/configure.py b/configure.py index 4d5e40a7b..fcf9e7e99 100755 --- a/configure.py +++ b/configure.py @@ -2435,7 +2435,7 @@ class ModulesChooser: elif not module.compatible_compiler(self._ccinfo, self._cc_min_version, self._archinfo.basename): self._not_using_because['incompatible compiler'].add(modname) return False - elif module.is_deprecated() and not self._options.enable_deprecated_features: + elif module.is_deprecated() and not self._options.enable_deprecated_features and modname not in self._options.enabled_modules: self._not_using_because['deprecated'].add(modname) return False elif module.is_experimental() and modname not in self._options.enabled_modules and not self._options.enable_experimental_features: diff --git a/doc/api_ref/ecc.rst b/doc/api_ref/ecc.rst index b21472a0e..b1223d8ea 100644 --- a/doc/api_ref/ecc.rst +++ b/doc/api_ref/ecc.rst @@ -21,6 +21,14 @@ Only curves over prime fields are supported. .. cpp:class:: EC_Group + .. cpp:function:: static bool EC_Group::supports_named_group(std::string_view name) + + Check if the named group is supported. + + .. cpp:function:: static bool EC_Group::supports_application_specific_group() + + Check if application specific groups are supported. + .. cpp:function:: EC_Group::from_OID(const OID& oid) Initialize an ``EC_Group`` using an OID referencing the curve @@ -30,6 +38,9 @@ Only curves over prime fields are supported. Initialize an ``EC_Group`` using a name (such as "secp256r1") + The curve may not be available, based on the build configuration. + If this is the case this function will throw `Not_Implemented`. + .. cpp:function:: EC_Group::from_PEM(std::string_view pem) Initialize an ``EC_Group`` using a PEM encoded parameter block diff --git a/news.rst b/news.rst index 6b8ad97ac..94203351d 100644 --- a/news.rst +++ b/news.rst @@ -21,6 +21,20 @@ Version 3.7.0, Not Yet Released #4492 #4479 #4510 #4511 #4512 #4517 #4518 #4532 #4533 #4549 #4550 #4552 #4556 #4557 #4564 #4566 #4570 #4601 #4604 #4608) +* An important note relating to EC groups, especially for users who do not build + the library using the default module settings (ie using ``--minimized-build`` + or ``--disable-deprecated-features``). Until 3.7.0, including support for an + elliptic curve algorithm such as ECDSA also implicitly pulled in support for + all elliptic curves. This is no longer the case. You can re-enable support for + specific named curves by adding a ``pcurves`` module, for example + ``pcurves_secp256r1`` or ``pcurves_brainpool384r1``. Also in 3.7.0, the old + BigInt based EC arithemtic implementation was moved to ``legacy_ec_point``, + which is marked as deprecated. Disabling this module will disable support for + certain (also deprecated) elliptic curves such as "x962_p239v1" and + "secp224k1". It will also disable support for application specific + curves. Depending on your usage you may need to enable the ``legacy_ec_point`` + module. (GH #4027) + * Change OID formatting and PK signature padding naming to avoid obsolete IEEE 1363 naming (GH #4600)
0
27
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
a9aebb6c08eb7d78a62283c33ece17b73e7c2f8c
Update for 1.11.14 release
commit a9aebb6c08eb7d78a62283c33ece17b73e7c2f8c Author: lloyd <[email protected]> Date: Sat Feb 28 00:36:49 2015 +0000 Update for 1.11.14 release diff --git a/doc/relnotes/1_11_14.rst b/doc/relnotes/1_11_14.rst index 88c14b444..320a5f221 100644 --- a/doc/relnotes/1_11_14.rst +++ b/doc/relnotes/1_11_14.rst @@ -1,26 +1,34 @@ -Version 1.11.14, Not Yet Released +Version 1.11.14, 2015-02-27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* The global state object previously used by the library has been removed and no - form of initialization is required to use the library. The global PRNG has - also been removed. LibraryInitializer remains as a stub. +* The global state object previously used by the library has been removed. + This includes the global PRNG. The library can be safely initialized + multiple times without harm. The engine code has also been removed, replaced by a much lighter-weight object registry system which provides lookups in faster time and with less memory overhead than the previous approach. + One caveat of the current system with regards to static linking: because only + symbols already mentioned elsewhere in the program are included in the final + link step, few algorithms will be available through the lookup system by + default, even though they were compiled into the library. Your application + must explicitly reference the types you require or they will not end up + being available in the final binary. See also Github issue #52 + + If you intend to build your application against a static library and don't + want to explicitly reference each algo object you might attempt to look up by + string, consider either building with `--via-amalgamation`, or else (much + simpler) using the amalgamation directly. + * The new `ffi` submodule provides a simple C API/ABI for a number of useful operations (hashing, ciphers, public key operations, etc) which is easily - accessed using the FFI modules included in many languages. A new Python - wrapper using the Python `ctypes` module is available. The old Boost.Python - wrapper has been removed. + accessed using the FFI modules included in many languages. -* PBKDF and KDF operations now provide a way to write the desired output - directly to an application-specified area rather than always allocating a new - heap buffer. +* A new Python wrapper (in `src/lib/python/botan.py`) using `ffi` and the Python + `ctypes` module is available. The old Boost.Python wrapper has been removed. -* HKDF, previously provided using a non-standard interface, now uses the - standard KDF interface and is retreivable using get_kdf. +* Add specialized reducers for P-192, P-224, P-256, and P-384 * OCB mode, which provides a fast and constant time AEAD mode without requiring hardware support, is now supported in TLS, following @@ -28,22 +36,48 @@ Version 1.11.14, Not Yet Released is not yet enabled by the default policy, and the ciphersuite numbers used are in the experimental range and may conflict with other uses. -* Add ability to read TLS policy from text file +* Add ability to read TLS policy from a text file using `TLS::Text_Policy`. + +* The amalgamation now splits off any ISA specific code (for instance, that + requiring SSSE3 instruction sets) into a new file named (for instance) + `botan_all_ssse3.cpp`. This allows the main amalgamation file to be compiled + without any special flags, so `--via-amalgamation` builds actually work now. + This is disabled with the build option `--single-amalgamation-file` + +* PBKDF and KDF operations now provide a way to write the desired output + directly to an application-specified area rather than always allocating a new + heap buffer. + +* HKDF, previously provided using a non-standard interface, now uses the + standard KDF interface and is retrievable using get_kdf. + +* It is once again possible to build the complete test suite without requiring + any boost libraries. This is currently only supported on systems supporting + the readdir interface. * Remove use of memset_s which caused problems with amalgamation on OS X. Github 42, 45 * The memory usage of the counter mode implementation has been reduced. + Previously it encrypted 256 blocks in parallel as this leads to a slightly + faster counter increment operation. Instead CTR_BE simply encrypts a buffer + equal in size to the advertised parallelism of the cipher implementation. + This is not measurably slower, and dramatically reduces the memory use of + CTR mode. * The memory allocator available on Unix systems which uses mmap and mlock to - lock a pool of memory now checks an environment variable - BOTAN_MLOCK_POOL_SIZE. If this is set to a smaller value then the library - would originally have allocated the user specified size is used. You can also - set it to zero to disable the pool entirely. Previously the allocator would - consume all available mlocked memory, this allows botan to coexist with an - application which wants to mlock memory of its own. + lock a pool of memory now checks environment variable BOTAN_MLOCK_POOL_SIZE + and interprets it as an integer. If the value set to a smaller value then the + library would originally have allocated (based on resource limits) the user + specified size is used instead. You can also set the variable to 0 to + disable the pool entirely. Previously the allocator would consume all + available mlocked memory, this allows botan to coexist with an application + which wants to mlock memory for its own uses. * The botan-config script previously installed on Unix systems has been - removed. Its functionality is replaced by the `config` command of the `botan` - tool executable, for example `botan config cflags` instead of `botan-config - --cflags`. + removed. Its functionality is replaced by the `config` command of the + `botan` tool executable, for example `botan config cflags` instead of + `botan-config --cflags`. + +* Added a target for POWER8 processors + diff --git a/doc/website/download.rst b/doc/website/download.rst index b6886a569..4df9094d1 100644 --- a/doc/website/download.rst +++ b/doc/website/download.rst @@ -14,8 +14,8 @@ Unsure which release you want? Check the :ref:`FAQ <devel_vs_stable>`. Current Development Series (1.11) ---------------------------------------- -The latest development release is :doc:`relnotes/1_11_13`: -:tgz:`1.11.13` (:tgz_sig:`sig <1.11.13>`) +The latest development release is :doc:`relnotes/1_11_14`: +:tgz:`1.11.14` (:tgz_sig:`sig <1.11.14>`) To access the latest unreleased sources, see :doc:`vcs`. A script also creates regular snapshots of trunk, which are available `here
0
88
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
c4ba92a457825276340eb448528d6d5a09e18009
Use __file__ to detect project root otherwise the module "configure" cannot be imported by the tests anymore
commit c4ba92a457825276340eb448528d6d5a09e18009 Author: Simon Warta <[email protected]> Date: Thu Oct 19 09:41:21 2017 +0200 Use __file__ to detect project root otherwise the module "configure" cannot be imported by the tests anymore diff --git a/configure.py b/configure.py index a4d2eadf0..e7d900e33 100755 --- a/configure.py +++ b/configure.py @@ -83,7 +83,7 @@ class Version(object): @staticmethod def get_data(): if not Version.data: - root_dir = os.path.dirname(sys.argv[0]) + root_dir = os.path.dirname(os.path.realpath(__file__)) Version.data = parse_version_file(os.path.join(root_dir, 'version.txt')) return Version.data
0
9
CVE-2002-0185
mod_python version 2.7.6 and earlier allows a module indirectly imported by a published module to then be accessed via the publisher, which allows remote attackers to call possibly dangerous functions from the imported module.
randombit
botan
762366ddee8911e2690a4650decba0500a00dece
update handbook and explain module_info tag
commit 762366ddee8911e2690a4650decba0500a00dece Author: Rene Meusel <[email protected]> Date: Tue Jul 12 10:00:07 2022 +0200 update handbook and explain module_info tag diff --git a/doc/dev_ref/configure.rst b/doc/dev_ref/configure.rst index 6e3971dc4..1bc71033c 100644 --- a/doc/dev_ref/configure.rst +++ b/doc/dev_ref/configure.rst @@ -161,7 +161,7 @@ Module Syntax --------------------- The ``info.txt`` files have the following elements. Not all are required; a minimal -file for a module with no dependencies might just contain a macro define. +file for a module with no dependencies might just contain a macro define and module_info. Lists: * ``comment`` and ``warning`` provides block-comments which @@ -196,6 +196,21 @@ Lists: Maps: * ``defines`` is a map from macros to datestamps. These macros will be defined in the generated ``build.h``. + * ``module_info`` contains documentation-friendly information about the module. + Available mappings: + + * ``name`` must contain a human-understandable name for the module + * ``brief`` may provide a short description about the module's contents + * ``type`` specifies the type of the module (defaults to ``Public``) + + * ``Public`` Library users can directly interact with this module. E.g. + they may enable or disable the module at will during build. + * ``Internal`` Library users must not directly interact with this module. + It is enabled and used as required by other modules. + * ``Virtual`` This module does not contain any implementation but acts as + a container for other sub-modules. It cannot be interacted with by the + library user and cannot be depended upon directly. + * ``libs`` specifies additional libraries which should be linked if this module is included. It maps from the OS name to a list of libraries (comma seperated). * ``frameworks`` is a macOS/iOS specific feature which maps from an OS name to @@ -220,6 +235,11 @@ An example:: DEFINE2 -> 20190301 </defines> + <module_info> + name -> "This Is Just To Say" + brief -> "Contains a poem by William Carlos Williams" + </module_info> + <comment> I have eaten the plums
0
84