diff options
Diffstat (limited to 'crypto/openssl/apps')
| -rw-r--r-- | crypto/openssl/apps/asn1parse.c | 2 | ||||
| -rw-r--r-- | crypto/openssl/apps/cms.c | 1 | ||||
| -rw-r--r-- | crypto/openssl/apps/enc.c | 2 | ||||
| -rw-r--r-- | crypto/openssl/apps/include/apps.h | 1 | ||||
| -rw-r--r-- | crypto/openssl/apps/lib/apps.c | 49 | ||||
| -rw-r--r-- | crypto/openssl/apps/ocsp.c | 21 | ||||
| -rw-r--r-- | crypto/openssl/apps/rand.c | 4 | ||||
| -rw-r--r-- | crypto/openssl/apps/storeutl.c | 16 | 
8 files changed, 30 insertions, 66 deletions
| diff --git a/crypto/openssl/apps/asn1parse.c b/crypto/openssl/apps/asn1parse.c index 4f882396d03d..4540d5f5fb6e 100644 --- a/crypto/openssl/apps/asn1parse.c +++ b/crypto/openssl/apps/asn1parse.c @@ -40,8 +40,8 @@ const OPTIONS asn1parse_options[] = {      {"length", OPT_LENGTH, 'p', "length of section in file"},      {"strparse", OPT_STRPARSE, 'p',       "offset; a series of these can be used to 'dig'"}, -    {"genstr", OPT_GENSTR, 's', "string to generate ASN1 structure from"},      {OPT_MORE_STR, 0, 0, "into multiple ASN1 blob wrappings"}, +    {"genstr", OPT_GENSTR, 's', "string to generate ASN1 structure from"},      {"genconf", OPT_GENCONF, 's', "file to generate ASN1 structure from"},      {"strictpem", OPT_STRICTPEM, 0,       "equivalent to '-inform pem' (obsolete)"}, diff --git a/crypto/openssl/apps/cms.c b/crypto/openssl/apps/cms.c index 919d306ff687..6f19414880c9 100644 --- a/crypto/openssl/apps/cms.c +++ b/crypto/openssl/apps/cms.c @@ -1280,6 +1280,7 @@ int cms_main(int argc, char **argv)              goto end;          }          if (ret <= 0) { +            BIO_printf(bio_err, "Error writing CMS output\n");              ret = 6;              goto end;          } diff --git a/crypto/openssl/apps/enc.c b/crypto/openssl/apps/enc.c index 3f45ba15e576..33949d402dd7 100644 --- a/crypto/openssl/apps/enc.c +++ b/crypto/openssl/apps/enc.c @@ -260,6 +260,8 @@ int enc_main(int argc, char **argv)                  goto opthelp;              if (k)                  n *= 1024; +            if (n > INT_MAX) +                goto opthelp;              bsize = (int)n;              break;          case OPT_K: diff --git a/crypto/openssl/apps/include/apps.h b/crypto/openssl/apps/include/apps.h index ceebfde72786..11381ea7da8c 100644 --- a/crypto/openssl/apps/include/apps.h +++ b/crypto/openssl/apps/include/apps.h @@ -103,7 +103,6 @@ int wrap_password_callback(char *buf, int bufsiz, int verify, void *cb_data);  /* progress callback for dsaparam, dhparam, req, genpkey, etc. */  int progress_cb(EVP_PKEY_CTX *ctx); -int chopup_args(ARGS *arg, char *buf);  void dump_cert_text(BIO *out, X509 *x);  void print_name(BIO *out, const char *title, const X509_NAME *nm);  void print_bignum_var(BIO *, const BIGNUM *, const char *, diff --git a/crypto/openssl/apps/lib/apps.c b/crypto/openssl/apps/lib/apps.c index d4e72307de58..1b9c9e3e9a19 100644 --- a/crypto/openssl/apps/lib/apps.c +++ b/crypto/openssl/apps/lib/apps.c @@ -83,55 +83,6 @@ static int set_multi_opts(unsigned long *flags, const char *arg,                            const NAME_EX_TBL *in_tbl);  int app_init(long mesgwin); -int chopup_args(ARGS *arg, char *buf) -{ -    int quoted; -    char c = '\0', *p = NULL; - -    arg->argc = 0; -    if (arg->size == 0) { -        arg->size = 20; -        arg->argv = app_malloc(sizeof(*arg->argv) * arg->size, "argv space"); -    } - -    for (p = buf;;) { -        /* Skip whitespace. */ -        while (*p && isspace(_UC(*p))) -            p++; -        if (*p == '\0') -            break; - -        /* The start of something good :-) */ -        if (arg->argc >= arg->size) { -            char **tmp; - -            arg->size += 20; -            tmp = OPENSSL_realloc(arg->argv, sizeof(*arg->argv) * arg->size); -            if (tmp == NULL) -                return 0; -            arg->argv = tmp; -        } -        quoted = *p == '\'' || *p == '"'; -        if (quoted) -            c = *p++; -        arg->argv[arg->argc++] = p; - -        /* now look for the end of this */ -        if (quoted) { -            while (*p && *p != c) -                p++; -            *p++ = '\0'; -        } else { -            while (*p && !isspace(_UC(*p))) -                p++; -            if (*p) -                *p++ = '\0'; -        } -    } -    arg->argv[arg->argc] = NULL; -    return 1; -} -  #ifndef APP_INIT  int app_init(long mesgwin)  { diff --git a/crypto/openssl/apps/ocsp.c b/crypto/openssl/apps/ocsp.c index 79b76a2ca747..95a95f56cb99 100644 --- a/crypto/openssl/apps/ocsp.c +++ b/crypto/openssl/apps/ocsp.c @@ -662,7 +662,8 @@ redo_accept:                  resp =                      OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST,                                           NULL); -                send_ocsp_response(cbio, resp); +                if (resp != NULL) +                    send_ocsp_response(cbio, resp);              }              goto done_resp;          } @@ -764,16 +765,18 @@ redo_accept:          BIO_free(derbio);      } -    i = OCSP_response_status(resp); -    if (i != OCSP_RESPONSE_STATUS_SUCCESSFUL) { -        BIO_printf(out, "Responder Error: %s (%d)\n", -                   OCSP_response_status_str(i), i); -        if (!ignore_err) +    if (resp != NULL) { +        i = OCSP_response_status(resp); +        if (i != OCSP_RESPONSE_STATUS_SUCCESSFUL) { +            BIO_printf(out, "Responder Error: %s (%d)\n", +                       OCSP_response_status_str(i), i); +            if (!ignore_err)                  goto end; -    } +        } -    if (resp_text) -        OCSP_RESPONSE_print(out, resp, 0); +        if (resp_text) +            OCSP_RESPONSE_print(out, resp, 0); +    }      /* If running as responder don't verify our own response */      if (cbio != NULL) { diff --git a/crypto/openssl/apps/rand.c b/crypto/openssl/apps/rand.c index b123a151ea74..da747c1783e4 100644 --- a/crypto/openssl/apps/rand.c +++ b/crypto/openssl/apps/rand.c @@ -1,5 +1,5 @@  /* - * Copyright 1998-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1998-2025 The OpenSSL Project Authors. All Rights Reserved.   *   * Licensed under the Apache License 2.0 (the "License").  You may not use   * this file except in compliance with the License.  You can obtain a copy @@ -199,7 +199,7 @@ int rand_main(int argc, char **argv)          int chunk;          chunk = scaled_num > buflen ? (int)buflen : (int)scaled_num; -        r = RAND_bytes(buf, chunk); +        r = RAND_bytes_ex(app_get0_libctx(), buf, chunk, 0);          if (r <= 0)              goto end;          if (format != FORMAT_TEXT) { diff --git a/crypto/openssl/apps/storeutl.c b/crypto/openssl/apps/storeutl.c index 62f0e6135640..f8ebde44481c 100644 --- a/crypto/openssl/apps/storeutl.c +++ b/crypto/openssl/apps/storeutl.c @@ -331,14 +331,22 @@ int storeutl_main(int argc, char *argv[])  static int indent_printf(int indent, BIO *bio, const char *format, ...)  {      va_list args; -    int ret; +    int ret, vret; + +    ret = BIO_printf(bio, "%*s", indent, ""); +    if (ret < 0) +        return ret;      va_start(args, format); +    vret = BIO_vprintf(bio, format, args); +    va_end(args); -    ret = BIO_printf(bio, "%*s", indent, "") + BIO_vprintf(bio, format, args); +    if (vret < 0) +        return vret; +    if (vret > INT_MAX - ret) +        return INT_MAX; -    va_end(args); -    return ret; +    return ret + vret;  }  static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata, | 
