aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/crypto/random.cpp
blob: 67d333a0d9231ce1bc3ebd690b3764ef4a8b1198 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "random.h"
#include <openssl/rand.h>

namespace vespalib::crypto {

void random_buffer(unsigned char* buf, size_t len) noexcept {
    if (::RAND_bytes(buf, len) != 1) {
        abort();
    }
}

}