47 Commits (fd3ed85c67174a0d3b6639ba9b237351d1c2201f)

Author SHA1 Message Date
aSoujyuTanaka c35b853576 Enable WinCE build without deceiving _MSC_VER.
Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11526)
3 years ago
Matt Caswell 00c405b365 Update copyright year
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12043)
3 years ago
Shane Lontis f32af93c92 Fix ERR_print_errors so that it matches the documented format in doc/man3/ERR_error_string.pod
Fixes #11743

The ouput format had 2 issues that caused it not to match the expected documented format:
(1) At some point the thread id printing was changed to use the OPENSSL_hex2str method which puts ':' between hex bytes.
    An internal function that skips the seperator has been added.
(2) The error code no longer exists. So this was completely removed from the string. It is now replaced by ::

As an example:
  00:77:6E:52:14:7F:00:00:error:asn1 encoding routines:asn1_check_tlen:wrong tag:crypto/asn1/tasn_dec.c:1135:
Is now:
  00776E52147F0000:error::asn1 encoding routines:asn1_check_tlen:wrong tag:crypto/asn1/tasn_dec.c:1135:

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11789)
3 years ago
Richard Levitte 82bd7c2cbd Add OPENSSL_hexstr2buf_ex() and OPENSSL_buf2hexstr_ex()
They do the same thing as OPENSSL_hexstr2buf() and OPENSSL_buf2hexstr(),
except they take a result buffer from the caller.

We take the opportunity to break out the documentation of the hex to /
from buffer conversion routines from the OPENSSL_malloc() file to its
own file.  These routines aren't memory allocation routines per se.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9303)
4 years ago
Matt Caswell 037439c46a Remove some utilities from the core to provider interface
The core provides a number of essential functions as "upcalls" to
providers. Some of those were just utility functions that wrap other
upcalls - which don't seem essential and bloat the interface. We should
remove them in order to simplify the interface.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9432)
4 years ago
Rich Salz b60cba3c5d Make allocation/free/clean available to providers
Also make OPENSSL_hexstr2buf available to providers.
EVP control functions need hexstring conversion, so move any
memory-allocating functions in o_str.c into new file mem_str.c

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8886)
4 years ago
Pauli 32ee452496 Remove OPENSSL_memcmp.
After avoiding OPENSSL_memcmp for EC curve comparison, there are no remaining
uses in the source code.  The function is only defined in an internal header
and thus should be safe to remove for 3.0.0.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/9207)
4 years ago
Bernd Edlinger e7a4682d0b Fix error handling at openssl_strerror_r
When bufsize == 0, openssl_strerror_r should return 0 (if _GNU_SOURCE is defined),
to be consistent with non-_GNU_SOURCE variants, which exhibit the same behavior.
Fix a few cases, where the return value of openssl_strerror_r was ignored.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9163)
4 years ago
Vitezslav Cizek e3b35d2b29 openssl_strerror_r: Fix handling of GNU strerror_r
GNU strerror_r may return either a pointer to a string that the function
stores in buf, or a pointer to some (immutable) static string in which case
buf is unused.

In such a case we need to set buf manually.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8371)
4 years ago
Richard Levitte 0e9725bcb9 Following the license change, modify the boilerplates in crypto/
[skip ci]

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7827)
5 years ago
Pauli 4cacc9d510 Revert "GH614: Use memcpy()/strdup() when possible"
This reverts commit a89c9a0d85.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4357)
6 years ago
Pauli 07016a8a31 Move e_os.h to be the very first include.
cryptilib.h is the second.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4188)
6 years ago
Rich Salz bef7a81530 Use "" not <> on e_os.h include
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4220)
6 years ago
Pauli a1df06b363 This has been added to avoid the situation where some host ctype.h functions
return true for characters > 127.  I.e. they are allowing extended ASCII
characters through which then cause problems.  E.g. marking superscript '2' as
a number then causes the common (ch - '0') conversion to number to fail
miserably.  Likewise letters with diacritical marks can also cause problems.

If a non-ASCII character set is being used (currently only EBCDIC), it is
adjusted for.

The implementation uses a single table with a bit for each of the defined
classes.  These functions accept an int argument and fail for
values out of range or for characters outside of the ASCII set.  They will
work for both signed and unsigned character inputs.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4102)
6 years ago
Benjamin Kaduk f44903a428 Address some -Wold-style-declaration warnings
gcc's -Wextra pulls in -Wold-style-declaration, which triggers when a
declaration has a storage-class specifier as a non-initial qualifier.
The ISO C formal grammar requires the storage-class to be the first
component of the declaration, if present.

Seeint as the register storage-class specifier does not really have any effect
anymore with modern compilers, remove it entirely while we're here, instead of
fixing up the order.

Interestingly, the gcc devteam warnings do not pull in -Wextra, though
the clang ones do.

[extended tests]

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3239)
6 years ago
Bernd Edlinger 01b76c2c5d Add -Wundef to --strict-warnings options.
Avoid a -Wundef warning in refcount.h
Avoid a -Wundef warning in o_str.c
Avoid a -Wundef warning in testutil.h
Include internal/cryptlib.h before openssl/stack.h
to avoid use of undefined symbol OPENSSL_API_COMPAT.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2712)
6 years ago
Kurt Roeckx 01238aec40 buf2hexstr: properly deal with empty string
It wrote before the start of the string

found by afl

Reviewed-by: Richard Levitte <levitte@openssl.org>

MR: #2994
7 years ago
Richard Levitte 7233bea263 Remove internal functions OPENSSL_strcasecmp and OPENSSL_strncasecmp
Their only reason to exist was that they didn't exist in VMS before
version 7.0.  We do not support such old versions any more.

However, for the benefit of systems that don't get strings.h included
by string.h, we include the former in e_os.h.


Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years ago
Andy Polyakov efdb2d6c79 crypto/o_str.c: add _GNU_SOURCE strerror_r case.
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years ago
Andy Polyakov 43c4116cd7 crypto/o_str.c: strerror_s is provided by specific compiler run-time,
not by OS [as was implied by guarding #if condition].

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years ago
Matt Caswell 7d37818dac Use strerror_r()/strerror_s() instead of strerror() where possible
The function strerror() is not thread safe. We should use strerror_r()
where possible, or strerror_s() on Windows.


Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years ago
Rich Salz 6286757141 Copyright consolidation 04/10
Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years ago
Matt Caswell 235f932930 Unsigned chars can't be negative
Fix a problem where an unsigned char was being checked to see if it was

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years ago
Rich Salz 14f051a0ae Make string_to_hex/hex_to_string public
Give the API new names, document it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years ago
Matt Caswell b6e785842a Fix master compile error
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years ago
Dmitry-Me d3c02d844a GH680: Reuse strnlen() in strndup()
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years ago
Dmitry-Me a89c9a0d85 GH614: Use memcpy()/strdup() when possible
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
7 years ago
Rich Salz 349807608f Remove /* foo.c */ comments
This was done by the following
        find . -name '*.[ch]' | /tmp/pl
where /tmp/pl is the following three-line script:
        print unless $. == 1 && m@/\* .*\.[ch] \*/@;
        close ARGV if eof; # Close file to reset $.

And then some hand-editing of other files.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years ago
Richard Levitte 31384753c7 Remove the "eay" c-file-style indicators
Since we don't use the eay style any more, there's no point tryint to
tell emacs to use it.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years ago
Rich Salz 7644a9aef8 Rename some BUF_xxx to OPENSSL_xxx
Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen}
to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen}
Add #define's for the old names.
Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years ago
Richard Levitte 6857079791 Identify and move OpenSSL internal header files
There are header files in crypto/ that are used by the rest of
OpenSSL.  Move those to include/internal and adapt the affected source
code, Makefiles and scripts.

The header files that got moved are:


Reviewed-by: Matt Caswell <matt@openssl.org>
8 years ago
Rich Salz 68b00c2372 ifdef cleanup part 3: OPENSSL_SYSNAME
Remove MS_STATIC; it's a relic from platforms <32 bits.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years ago
Matt Caswell 0f113f3ee4 Run util/openssl-format-source -v -c .
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years ago
Andy Polyakov a006fef78e Improve WINCE support.
Submitted by: Pierre Delaage
11 years ago
Dr. Stephen Henson 0176842592 PR: 1945
Submitted by: Guenter <lists@gknw.net>
Approved by: steve@openssl.org

Netware compilation fix for nonexistent header.
14 years ago
Dr. Stephen Henson 52108cecc0 <strings.h> does not exist under WIN32. 16 years ago
Ben Laurie f12797a447 Missing headers. 16 years ago
Andy Polyakov 7a06050cd3 "Overload" SunOS 4.x memcmp, which ruins ASN1_OBJECT table lookups.
PR: 1196
Submitted by: Russel Ruby
18 years ago
Andy Polyakov e6d27baf52 Rely on e_os.h to appropriately define str[n]casecmp in non-POSIX
19 years ago
Andy Polyakov 3b4de6e4cc Borrow #include <string[s].h> from e_os.h. 19 years ago
Richard Levitte dc56eb5079 o_str.c: Windows doesn't have <strings.h>, and since we use _strnicmp() and
_stricmp() on that platform, use the appropriate header file for it,
o_str.h: we only want to get size_t, which is defined in <stddef.h>.

Philippe Bougeret <philippe.bougeret@freesbee.fr> notified us about Windows
not having a <strings.h>
19 years ago
Richard Levitte abd23881c1 Synchronise o_str.c between 0.9.8-dev and 0.9.7-stable. 19 years ago
Richard Levitte a0b5ebeac6 Typo... 19 years ago
Richard Levitte 8ee18dd520 Make sure toupper() is properly declared. 19 years ago
Richard Levitte f0c5db92f7 Include strings.h so strcasecmp() and strncasecmp() get properly declared. 20 years ago
Dr. Stephen Henson 82384690e2 Typos. 20 years ago
Richard Levitte e6fa67fa93 Generalise the definition of strcasecmp() and strncasecmp() for
platforms that don't (necessarely) have it.  In the case of VMS, this
means moving a couple of functions from apps/ to crypto/ and make them
general (although only used privately).
20 years ago