MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / writeKeyToBio

Function writeKeyToBio

plugins/wasi_crypto/utils/evp_wrapper.cpp:33–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32template <typename T, typename WriteFunc>
33WasiCryptoExpect<T> writeKeyToBio(EVP_PKEY *Key, WriteFunc &&Func) {
34 BioPtr Bio{BIO_new(BIO_s_mem())};
35 opensslCheck(Func(Bio.get(), Key));
36
37 BUF_MEM *Mem = nullptr;
38 opensslCheck(BIO_get_mem_ptr(Bio.get(), &Mem));
39
40 T Ret(Mem->length);
41 size_t Size;
42 if (BIO_read_ex(Bio.get(), Ret.data(), Ret.size(), &Size) &&
43 Size == Ret.size()) {
44 return Ret;
45 }
46 return WasiCryptoUnexpect(__WASI_CRYPTO_ERRNO_ALGORITHM_FAILURE);
47}
48
49} // namespace
50

Callers

nothing calls this directly

Calls 5

WasiCryptoUnexpectFunction · 0.85
FuncClass · 0.50
getMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected