VMS: Correct error reporting in crypto/rand/rand_vms.c
authorRichard Levitte <levitte@openssl.org>
Thu, 13 Feb 2020 12:11:50 +0000 (13:11 +0100)
committerRichard Levitte <levitte@openssl.org>
Sat, 15 Feb 2020 05:48:04 +0000 (06:48 +0100)
The future style that's coming with OpenSSL 3.0 was used, we need to
revert that back to "traditional" style.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11088)

crypto/err/openssl.txt
crypto/rand/rand_err.c
crypto/rand/rand_vms.c
include/openssl/randerr.h

index e4cda9735eb9a0b5f39aa6747509af4c949b2677..f4a14ccb82247bb153c222254ad2f66257219ee5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the OpenSSL license (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
@@ -1002,6 +1002,7 @@ PKCS7_F_PKCS7_SIGNER_INFO_SIGN:139:PKCS7_SIGNER_INFO_sign
 PKCS7_F_PKCS7_SIGN_ADD_SIGNER:137:PKCS7_sign_add_signer
 PKCS7_F_PKCS7_SIMPLE_SMIMECAP:119:PKCS7_simple_smimecap
 PKCS7_F_PKCS7_VERIFY:117:PKCS7_verify
+RAND_F_DATA_COLLECT_METHOD:127:data_collect_method
 RAND_F_DRBG_BYTES:101:drbg_bytes
 RAND_F_DRBG_GET_ENTROPY:105:drbg_get_entropy
 RAND_F_DRBG_SETUP:117:drbg_setup
index 071376a173ab938465846bcf17398d78127f2457..a3ae5f53c2956a73ad0137daa523aeea3be17bd2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -14,6 +14,8 @@
 #ifndef OPENSSL_NO_ERR
 
 static const ERR_STRING_DATA RAND_str_functs[] = {
+    {ERR_PACK(ERR_LIB_RAND, RAND_F_DATA_COLLECT_METHOD, 0),
+     "data_collect_method"},
     {ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_BYTES, 0), "drbg_bytes"},
     {ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_GET_ENTROPY, 0), "drbg_get_entropy"},
     {ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_SETUP, 0), "drbg_setup"},
index ba8386e30e7c33f07d57523fb6c70b7424ad0456..d09b2380de57b8db46d414242b2367a171d4d712 100644 (file)
@@ -13,6 +13,8 @@
 # define __NEW_STARLET 1         /* New starlet definitions since VMS 7.0 */
 # include <unistd.h>
 # include "internal/cryptlib.h"
+# include <openssl/bio.h>
+# include <openssl/err.h>
 # include <openssl/rand.h>
 # include "crypto/rand.h"
 # include "rand_local.h"
@@ -456,9 +458,12 @@ size_t data_collect_method(RAND_POOL *pool)
      * If we can't feed the requirements from the caller, we're in deep trouble.
      */
     if (!ossl_assert(total_length >= bytes_needed)) {
-        ERR_raise_data(ERR_LIB_RAND, RAND_R_RANDOM_POOL_UNDERFLOW,
-                       "Needed: %zu, Available: %zu",
-                       bytes_needed, total_length);
+        char buf[100];           /* That should be enough */
+
+        BIO_snprintf(buf, sizeof(buf), "Needed: %zu, Available: %zu",
+                     bytes_needed, total_length);
+        RANDerr(RAND_F_DATA_COLLECT_METHOD, RAND_R_RANDOM_POOL_UNDERFLOW);
+        ERR_add_error_data(1, buf);
         return 0;
     }
 
index 301830bccc957984e8d02baeccfc6ad0135e1e33..79d57905e3cb42982702298801fd0a4b2d4c80a7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -21,6 +21,7 @@ int ERR_load_RAND_strings(void);
 /*
  * RAND function codes.
  */
+# define RAND_F_DATA_COLLECT_METHOD                       127
 # define RAND_F_DRBG_BYTES                                101
 # define RAND_F_DRBG_GET_ENTROPY                          105
 # define RAND_F_DRBG_SETUP                                117