diff options
author | 2021-02-13 03:10:40 +0100 | |
---|---|---|
committer | 2021-02-12 18:10:40 -0800 | |
commit | 27f13eb527bd04599ed887d58bf2ad05c477ca02 (patch) | |
tree | dc6c0da25882e102714de35e35b566bfa7f37d8d /projects/libsodium/fake_random.h | |
parent | f26468f501235d3eb3b5e60d2efbfbdd657124e4 (diff) |
libsodium: don't use the stack for potentially large data (#5190)
* libsodium: don't use the stack for potentially large data
Also check return codes of verification functions, and properly
check the random implementation name.
* Add license headers
Diffstat (limited to 'projects/libsodium/fake_random.h')
-rw-r--r-- | projects/libsodium/fake_random.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/projects/libsodium/fake_random.h b/projects/libsodium/fake_random.h index 36d8d89b..9519b0ce 100644 --- a/projects/libsodium/fake_random.h +++ b/projects/libsodium/fake_random.h @@ -1,3 +1,17 @@ +// Copyright 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef FAKE_RANDOM_H_ #define FAKE_RANDOM_H_ @@ -43,7 +57,7 @@ setup_fake_random(const unsigned char * seed, const size_t seed_size) { int fake_random_set = randombytes_set_implementation(&fake_random); assert(fake_random_set == 0); - assert(randombytes_implementation_name() == "fake_random"); + assert(strcmp(randombytes_implementation_name(), "fake_random") == 0); int initialized = sodium_init(); assert(initialized >= 0); } |