[openssl] master update

Richard Levitte levitte at openssl.org
Wed Jan 27 11:07:24 UTC 2021

The branch master has been updated
       via  eeb09f1bd7754e85e832853f46a726c761c93df1 (commit)
      from  0c3eb2793b2a1fe35beeb90ba8f5cb2a0fdc3270 (commit)

- Log -----------------------------------------------------------------
commit eeb09f1bd7754e85e832853f46a726c761c93df1
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Jan 26 06:48:11 2021 +0100

    Fix OSSL_PARAM_allocate_from_text() for EBCDIC
    OSSL_PARAM_allocate_from_text() converted text values to UTF-8
    OSSL_PARAMs with a simple strncpy().  However, if the text is EBCDIC,
    that won't become UTF-8.  Therefore, it's made to convert from EBCDIC
    to ASCII on platforms where the native character encoding is the
    One might argue that the conversion should be the responsibility of
    the application.  However, this is a helper function, and the calling
    application can't easily know what sort of OSSL_PARAM the input values
    are going to be used for.
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/13961)


Summary of changes:
 crypto/params_from_text.c                  | 5 +++++
 doc/man3/OSSL_PARAM_allocate_from_text.pod | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/crypto/params_from_text.c b/crypto/params_from_text.c
index d458d31b2e..24d96108d0 100644
--- a/crypto/params_from_text.c
+++ b/crypto/params_from_text.c
@@ -9,6 +9,7 @@
 #include <string.h>
+#include <openssl/ebcdic.h>
 #include <openssl/err.h>
 #include <openssl/params.h>
@@ -139,7 +140,11 @@ static int construct_from_text(OSSL_PARAM *to, const OSSL_PARAM *paramdef,
         case OSSL_PARAM_UTF8_STRING:
+            ebcdic2ascii(buf, value, buf_n);
             strncpy(buf, value, buf_n);
             if (ishex) {
diff --git a/doc/man3/OSSL_PARAM_allocate_from_text.pod b/doc/man3/OSSL_PARAM_allocate_from_text.pod
index 011685c8c8..6522e3b135 100644
--- a/doc/man3/OSSL_PARAM_allocate_from_text.pod
+++ b/doc/man3/OSSL_PARAM_allocate_from_text.pod
@@ -73,8 +73,10 @@ considers that an error.
 If I<key> started with "hex", OSSL_PARAM_allocate_from_text()
 considers that an error.
-Otherwise, I<value> is considered a C string and is copied with no
-further checks to the I<< to->data >> storage.
+Otherwise, I<value> is considered a C string and is copied to the
+I<< to->data >> storage.
+On systems where the native character encoding is EBCDIC, the bytes in
+I<< to->data >> are converted to ASCII.

More information about the openssl-commits mailing list