diff options
| author | 2022-08-22 21:43:08 +0000 | |
|---|---|---|
| committer | 2022-08-22 21:43:08 +0000 | |
| commit | ec6e1ef4181ee5c2fec3e84869befe0c20844ee6 (patch) | |
| tree | 43b0968b45023dfef12ec0b2974eced117a70dc4 | |
| parent | be6aec41efa563edc40b9bf3cf1fd555fcec14b4 (diff) | |
| parent | 04137372dcfe0d7eba8545efd65b7f43b682bb71 (diff) | |
Merge "libbinder: Remove dependency on openssl for Trusty kernel"
| -rw-r--r-- | libs/binder/trusty/OS.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/binder/trusty/OS.cpp b/libs/binder/trusty/OS.cpp index bbfa3818ea..b21fe6acf5 100644 --- a/libs/binder/trusty/OS.cpp +++ b/libs/binder/trusty/OS.cpp @@ -14,7 +14,11 @@ * limitations under the License. */ +#if defined(TRUSTY_USERSPACE) #include <openssl/rand.h> +#else +#include <lib/rand/rand.h> +#endif #include "../OS.h" @@ -28,8 +32,13 @@ Result<void> setNonBlocking(android::base::borrowed_fd fd) { } status_t getRandomBytes(uint8_t* data, size_t size) { +#if defined(TRUSTY_USERSPACE) int res = RAND_bytes(data, size); return res == 1 ? OK : UNKNOWN_ERROR; +#else + int res = rand_get_bytes(data, size); + return res == 0 ? OK : UNKNOWN_ERROR; +#endif // TRUSTY_USERSPACE } status_t dupFileDescriptor(int oldFd, int* newFd) { |