MCPcopy Create free account
hub / github.com/apache/trafficserver / TSSslSecretGet

Function TSSslSecretGet

src/api/InkAPI.cc:8075–8103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8073}
8074
8075char *
8076TSSslSecretGet(const char *secret_name, int secret_name_length, int *secret_data_length)
8077{
8078 sdk_assert(secret_name != nullptr);
8079 sdk_assert(secret_data_length != nullptr);
8080
8081 bool loading = true;
8082 SSLConfigParams *params = SSLConfig::load_acquire();
8083 if (params == nullptr) {
8084 params = SSLConfig::acquire();
8085 loading = false;
8086 }
8087 std::string const secret_data = params->secrets.getSecret(std::string(secret_name, secret_name_length));
8088 char *data{nullptr};
8089 if (secret_data.empty()) {
8090 *secret_data_length = 0;
8091
8092 } else {
8093 data = static_cast<char *>(ats_malloc(secret_data.size()));
8094 memcpy(data, secret_data.data(), secret_data.size());
8095 *secret_data_length = secret_data.size();
8096 }
8097 if (loading) {
8098 SSLConfig::load_release(params);
8099 } else {
8100 SSLConfig::release(params);
8101 }
8102 return data;
8103}
8104
8105/**
8106 * This function retrieves an array of lookup keys for client contexts loaded in

Callers

nothing calls this directly

Calls 9

acquireFunction · 0.85
stringClass · 0.85
ats_mallocFunction · 0.85
releaseFunction · 0.85
getSecretMethod · 0.80
memcpyFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected