]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - providers/implementations/rands/seeding/rand_vxworks.c
Update copyright year
[thirdparty/openssl.git] / providers / implementations / rands / seeding / rand_vxworks.c
index 427d50d2637e7361e21bbfa654eb242e02636dbc..12be9357bf2825d45dffb713a1b0de1f1a908356 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2021 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
 #include <openssl/opensslconf.h>
 
 #include <openssl/rand.h>
-#include "rand_local.h"
+#include "crypto/rand_pool.h"
 #include "crypto/rand.h"
 #include "internal/cryptlib.h"
+#include "prov/seeding.h"
 #include <version.h>
 #include <taskLib.h>
 
@@ -62,20 +63,20 @@ static uint64_t get_timer_bits(void)
  * empty implementation
  * vxworks does not need to init/cleanup or keep open the random lib
  */
-int rand_pool_init(void)
+int ossl_rand_pool_init(void)
 {
     return 1;
 }
 
-void rand_pool_cleanup(void)
+void ossl_rand_pool_cleanup(void)
 {
 }
 
-void rand_pool_keep_random_devices_open(int keep)
+void ossl_rand_pool_keep_random_devices_open(int keep)
 {
 }
 
-int rand_pool_add_additional_data(RAND_POOL *pool)
+int ossl_rand_pool_add_additional_data(RAND_POOL *pool)
 {
     struct {
         CRYPTO_THREAD_ID tid;
@@ -92,10 +93,10 @@ int rand_pool_add_additional_data(RAND_POOL *pool)
     data.tid = CRYPTO_THREAD_get_current_id();
     data.time = get_timer_bits();
 
-    return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0);
+    return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0);
 }
 
-int rand_pool_add_nonce_data(RAND_POOL *pool)
+int ossl_pool_add_nonce_data(RAND_POOL *pool)
 {
     struct {
         pid_t pid;
@@ -114,23 +115,23 @@ int rand_pool_add_nonce_data(RAND_POOL *pool)
     data.tid = CRYPTO_THREAD_get_current_id();
     data.time = get_time_stamp();
 
-    return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0);
+    return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0);
 }
 
-size_t rand_pool_acquire_entropy(RAND_POOL *pool)
+size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
 {
 #if defined(RAND_SEED_VXRANDLIB)
     /* vxRandLib based entropy method */
     size_t bytes_needed;
 
-    bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
+    bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
     if (bytes_needed > 0)
     {
         int retryCount = 0;
         STATUS result = ERROR;
         unsigned char *buffer;
 
-        buffer = rand_pool_add_begin(pool, bytes_needed);
+        buffer = ossl_rand_pool_add_begin(pool, bytes_needed);
         while ((result != OK) && (retryCount < 10)) {
             RANDOM_NUM_GEN_STATUS status = randStatus();
 
@@ -138,7 +139,7 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
                     || (status == RANDOM_NUM_GEN_MAX_ENTROPY) ) {
                 result = randBytes(buffer, bytes_needed);
                 if (result == OK)
-                    rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
+                    ossl_rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
                 /*
                  * no else here: randStatus said ok, if randBytes failed
                  * it will result in another loop or no entropy
@@ -155,12 +156,12 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
             retryCount++;
         }
     }
-    return rand_pool_entropy_available(pool);
+    return ossl_rand_pool_entropy_available(pool);
 #else
     /*
      * SEED_NONE means none, without randlib we dont have entropy and
      * rely on it being added externally
      */
-    return rand_pool_entropy_available(pool);
+    return ossl_rand_pool_entropy_available(pool);
 #endif /* defined(RAND_SEED_VXRANDLIB) */
 }