aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/crypto/random.cpp
blob: 5811aef652334689968f6a99b4de75b0c10d2608 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright Vespa.ai. 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();
    }
}

}