summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* BN_CTX_get() can fail - consistently check its return value.jsing2015-02-0912-110/+140
| | | | | | | | | | | | | | | There are currently cases where the return from each call is checked, the return from only the last call is checked and cases where it is not checked at all (including code in bn, ec and engine). Checking the last return value is valid as once the function fails it will continue to return NULL. However, in order to be consistent check each call with the same idiom. This makes it easy to verify. Note there are still a handful of cases that do not follow the idiom - these will be handled separately. ok beck@ doug@
* Delete a lot of #if 0 code in libressl.doug2015-02-071-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There are a few instances where #if 1 is removed but the code remains. Based on the following OpenSSL commits. Some of the commits weren't strictly deletions so they are going to be split up into separate commits. 6f91b017bbb7140f816721141ac156d1b828a6b3 3d47c1d331fdc7574d2275cda1a630ccdb624b08 dfb56425b68314b2b57e17c82c1df42e7a015132 c8fa2356a00cbaada8963f739e5570298311a060 f16a64d11f55c01f56baa62ebf1dec7f8fe718cb 9ccc00ef6ea65567622e40c49aca43f2c6d79cdb 02a938c953b3e1ced71d9a832de1618f907eb96d 75d0ebef2aef7a2c77b27575b8da898e22f3ccd5 d6fbb194095312f4722c81c9362dbd0de66cb656 6f1a93ad111c7dfe36a09a976c4c009079b19ea1 1a5adcfb5edfe23908b350f8757df405b0f5f71f 8de24b792743d11e1d5a0dcd336a49368750c577 a2b18e657ea1a932d125154f4e13ab2258796d90 8e964419603d2478dfb391c66e7ccb2dcc9776b4 32dfde107636ac9bc62a5b3233fe2a54dbc27008 input + ok jsing@, miod@, tedu@
* deregister; no binary changejsg2014-10-286-23/+23
| | | | ok jsing@ miod@
* Use arc4random_buf() instead of RAND_bytes() or RAND_pseudo_bytes().jsing2014-10-222-22/+10
| | | | | | | | arc4random_buf() is guaranteed to always succeed - it is worth noting that a number of the replaced function calls were already missing return value checks. ok deraadt@
* None of these need to include <openssl/rand.h>jsing2014-10-182-6/+2
|
* if (x) FOO_free(x) -> FOO_free(x).miod2014-07-125-23/+14
| | | | | | | Improves readability, keeps the code smaller so that it is warmer in your cache. review & ok deraadt@
* typosmiod2014-07-121-1/+1
|
* Apparently better fix for OpenSSL PR #3397 (Joyent bug #7704), from OpenSSLmiod2014-07-111-2/+2
| | | | trunk
* Make sure BN_sqr never returns negative numbers.miod2014-07-111-1/+2
| | | | OpenSSL PR #3400 via OpenSSL trunk.
* Only import cryptlib.h in the four source files that actually need it.jsing2014-07-1125-57/+70
| | | | | | | | Remove the openssl public includes from cryptlib.h and add a small number of includes into the source files that actually need them. While here, also sort/group/tidy the includes. ok beck@ miod@
* Explicitly include <openssl/opensslconf.h> in every file that referencesjsing2014-07-1011-14/+44
| | | | | | | | | an OPENSSL_NO_* define. This avoids relying on something else pulling it in for us, plus it fixes several cases where the #ifndef OPENSSL_NO_XYZ is never going to do anything, since OPENSSL_NO_XYZ will never defined, due to the fact that opensslconf.h has not been included. This also includes some miscellaneous sorting/tidying of headers.
* Stop including standard headers via cryptlib.h - pull in the headers thatjsing2014-07-108-13/+25
| | | | | | are needed in the source files that actually require them. ok beck@ miod@
* Remove leading underscore from _BYTE_ORDER and _{LITTLE,BIG}_ENDIAN, to bemiod2014-07-091-2/+2
| | | | | more friendly to systems where the underscore flavours may be defined as empty. Found the hard way be bcook@; joint brainstrom with bcook beck and guenther
* remove unused, private version strings except SSL_version_strbcook2014-07-091-3/+1
| | | | | | Also remove unused des_ver.h, which exports some of these strings, but is not installed. ok miod@ tedu@
* When building a BN on the stack in BN_div(), make sure to initialize all itsmiod2014-06-271-1/+2
| | | | | | fields (i.e. the flags field) before using it. This is currently harmless, but might not be if we end up invoking other BN functions checking for constant-time processing requirement in the future.
* hand-KNF macro the do { } while loopsderaadt2014-06-272-11/+16
|
* Fix incorrect bounds check in amd64 assembly version of bn_mul_mont();miod2014-06-202-4/+4
| | | | | noticed and fix by Fedor Indutny of Joyent ( https://github.com/joyent/node/issues/7704 )
* tags as requested by miod and teduderaadt2014-06-1232-30/+32
|
* malloc() result does not need a cast.deraadt2014-06-075-6/+6
| | | | ok miod
* s/assember/assembler/ before someone gets offended. At the lastderaadt2014-06-068-13/+13
| | | | | hackathon, just saying 'ass ember' was enough to start giggles. Unfortunately far more offensive stuff remains in here...
* Get the public headers from the official place with <openssl/ >deraadt2014-05-311-1/+1
| | | | from Brent Cook
* more: no need for null check before freederaadt2014-05-301-2/+1
| | | | ok tedu guenther
* ok, next pass after review: when possible, put the reallocarray argumentsderaadt2014-05-292-6/+6
| | | | in the "size_t nmemb, size_t size"
* convert 53 malloc(a*b) to reallocarray(NULL, a, b). that is 53deraadt2014-05-294-10/+10
| | | | | | | | | potential integer overflows easily changed into an allocation return of NULL, with errno nicely set if need be. checks for an allocations returning NULL are commonplace, or if the object is dereferenced (quite normal) will result in a nice fault which can be detected & repaired properly. ok tedu
* Everything sane has stdio, and FILE *. we don't need ifdefs for this.beck2014-05-292-6/+0
| | | | ok to firebomb from tedu@
* calloc instead of malloc/memset. from Benjamin Baiertedu2014-05-251-2/+1
|
* Almost nothing actually needs to include <openssl/e_os2.h>, however byjsing2014-05-241-1/+2
| | | | | | | including it they get <openssl/opensslconf.h>. So instead of pulling in <openssl/e_os2.h>, just pull in <openssl/opensslconf.h>. "go ahead" miod@
* Replace (sometimes conditional) use of alloca with malloc, and clearingmiod2014-05-232-39/+16
| | | | | | through volatile pointers with explicit_bzero(). ok beck@ jsing@
* if (x) free(x) -> free(x); semantic patch generated with coccinelle, carefullymiod2014-05-222-12/+6
| | | | eyeballed before applying. Contributed by Cyril Roelandt on tech@
* Stop being a dummy... presumably these are left overs from pedantic modejsing2014-05-151-2/+0
| | | | | | that were not wrapped with #if PEDANTIC. ok miod@
* knfectomie.jsing2014-05-081-653/+818
|
* Emergency knfectomie requested by tedu@.jsing2014-05-0830-6133/+6618
|
* with the first bug it uncovered fixed, clear all bignums again.tedu2014-05-071-17/+9
| | | | i've never worked on codebase so resistant to efforts to improve it.
* in BN_clear_free, don't cleanse the data if the static data flag is set.tedu2014-05-071-3/+2
| | | | | | | | much debugging work done by otto. ok miod otto. side note: BN_FLG_STATIC_DATA doesn't actually mean the data is static. it's also used to indicate the data may be secretly shared behind your back as a sort of poor man's refcounting, but without the refcounting.
* revert, thanks sthentedu2014-05-071-9/+17
|
* inspired by a cloudflare diff, cleanse old memory when expanding a bignum.tedu2014-05-051-17/+9
| | | | | | however, instead of trying to audit all the places where a secret bignum is used, apply the big hammer and clear all bignums when freed. ok deraadt miod
* typosmiod2014-05-031-2/+2
|
* More use of 64-bit registers which needs to be disabled under OpenBSD.miod2014-05-021-0/+2
|
* Do not output SOM-specific directives.miod2014-05-011-0/+6
|
* Fix include filename to get register name aliases under BSDmiod2014-05-011-6/+1
|
* Pass -Werror in the !BN_LLONG !BN_UMULT_LOHI !BN_UMULT_HIGH case.miod2014-05-011-4/+4
|
* dead meatmiod2014-05-012-2528/+0
|
* First pass at removing win64 support from the assembly generating Perljsing2014-04-302-286/+0
| | | | | | | scripts. We certainly do not need an identical copy of the win64 exception handler in each script (surely one copy would be sufficient). ok miod@
* Remove WIN32, WIN64 and MINGW32 tentacles.miod2014-04-282-10/+1
| | | | | | | | Also check for _LP64 rather than __arch64__ (the former being more reliable than __LP64__ or __arch64__) to tell 64-bit int platforms apart from 32-bit int platforms. Loosely based upon a diff from Martijn van Duren on tech@
* Try to clean the maze of <openssl/bn.h> defines regarding the BN internals.miod2014-04-2410-227/+25
| | | | | | | | | | | | | | | | | | | | | | | The intent of this change is to only keep support for two kind of architectures: - those with 32-bit int and long, and 64-bit long long, where ``long * long -> long long'' multiplication routines are available. - those with 64-bit int and long, and no 128-bit long long type. This gets rid of the SIXTY_FOUR_BIT_LONG, SIXTY_FOUR_BIT (not the same!), THIRTY_TWO_BIT, SIXTEEN_BIT and EIGHT_BIT defines. After this change, the types and defines are as follows: arch: 64bit 32bit rationale BN_LLONG undefined defined defined if l * l -> ll BN_ULLONG undefined u long long result of BN_LONG * BN_LONG BN_ULONG u long u int native register size BN_LONG long int the same, signed BN_BITS 128 64 size of 2*BN_ULONG in bits BN_BYTES 8 4 size of 2*BN_ULONG in bytes BN_BITS2 64 32 BN_BITS / 2 Tested on various 32-bit and 64-bit OpenBSD systems of various endianness.
* One last Dec C tentacle on alpha.miod2014-04-231-4/+1
|
* When I grow up, I want to write workaround for long long multiplicationsmiod2014-04-231-15/+0
| | | | under __TANDEM systems and compilers, using hardcoded octal numbers. NOT.
* Remove IRIX_CC_BUG workaround.miod2014-04-231-6/+0
|
* I'm glad to know that Ultrix CC has a bug optimizing switch() statementsmiod2014-04-231-5/+0
| | | | | lacking an explicit `case 0:' construct. But Ultrix has been dead for more than 15 years, really. Don't give it any reason to move out of its coffin.
* Unifdef -UPEDANTIC. ok beck@ tedu@miod2014-04-232-2/+2
|