summaryrefslogtreecommitdiffstats
path: root/fnet/src/tests/frt/rpc/my_crypto_engine.hpp
blob: 6f573e5695a8b23a650b6e2c17c8766922376425 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

vespalib::CryptoEngine::SP my_crypto_engine() {
    const char *env_str = getenv("CRYPTOENGINE");
    if (!env_str) {
        fprintf(stderr, "crypto engine: default\n");
        return vespalib::CryptoEngine::get_default();
    }
    std::string engine(env_str);
    if (engine == "xor") {
        fprintf(stderr, "crypto engine: xor\n");
        return std::make_shared<vespalib::XorCryptoEngine>();
    }
    TEST_FATAL(("invalid crypto engine: " + engine).c_str());
    abort();
}