MCPcopy Create free account
hub / github.com/ceph/ceph / init_ctx

Method init_ctx

src/client/FSCrypt.cc:1050–1074  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048}
1049
1050FSCryptContextRef FSCrypt::init_ctx(const std::vector<unsigned char>& fscrypt_auth)
1051{
1052 if (fscrypt_auth.size() == 0) {
1053 return nullptr;
1054 }
1055
1056 FSCryptContextRef ctx = std::make_shared<FSCryptContext>(cct);
1057
1058 bufferlist bl;
1059 bl.append((const char *)fscrypt_auth.data(), fscrypt_auth.size());
1060
1061 auto bliter = bl.cbegin();
1062 try {
1063 ctx->decode(bliter);
1064 } catch (buffer::error& err) {
1065 if (fscrypt_auth.size()) {
1066 ldout(cct, 0) << __func__ << " " << " failed to decode fscrypt_auth:" << fscrypt_hex_str(fscrypt_auth.data(), fscrypt_auth.size()) << dendl;
1067 } else {
1068 ldout(cct, 0) << __func__ << " " << " failed to decode fscrypt_auth: fscrypt_auth.size() == 0" << dendl;
1069 }
1070 return nullptr;
1071 }
1072
1073 return ctx;
1074}
1075
1076FSCryptDenc *FSCrypt::init_denc(const FSCryptContextRef& ctx, FSCryptKeyValidatorRef *kv,
1077 std::function<FSCryptDenc *()> gen_denc)

Callers 2

init_fscrypt_ctxMethod · 0.80
_symlinkMethod · 0.80

Calls 6

fscrypt_hex_strFunction · 0.85
sizeMethod · 0.45
appendMethod · 0.45
dataMethod · 0.45
cbeginMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected