MCPcopy Create free account
hub / github.com/apache/brpc / initialize

Method initialize

src/brpc/policy/dh.cpp:34–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34int DHWrapper::initialize(bool ensure_128bytes_public_key) {
35 for (;;) {
36 if (do_initialize() != 0) {
37 return -1;
38 }
39 if (ensure_128bytes_public_key) {
40 const BIGNUM* pub_key = NULL;
41 DH_get0_key(_pdh, &pub_key, NULL);
42 int key_size = BN_num_bytes(pub_key);
43 if (key_size != 128) {
44 RPC_VLOG << "regenerate 128B key, current=" << key_size;
45 clear();
46 continue;
47 }
48 }
49 break;
50 }
51 return 0;
52}
53
54int DHWrapper::copy_public_key(char* pkey, int* pkey_size) const {
55 const BIGNUM* pub_key = NULL;

Callers 1

GenerateMethod · 0.80

Calls 2

DH_get0_keyFunction · 0.85
clearFunction · 0.50

Tested by

no test coverage detected