-static EVP_PKEY *load_key(const char *file, int private)
-{
- BIO *key;
- EVP_PKEY *pkey = NULL;
- int ret = check_key_file(file, private);
-
- if (ret < 0) {
- PARA_ERROR_LOG("%s\n", para_strerror(-ret));
- return NULL;
- }
- key = BIO_new(BIO_s_file());
- if (!key)
- return NULL;
- if (BIO_read_filename(key, file) > 0) {
- if (private == LOAD_PRIVATE_KEY)
- pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, NULL);
- else
- pkey = PEM_read_bio_PUBKEY(key, NULL, NULL, NULL);
- }
- BIO_free(key);
- return pkey;
-}
-
-static int get_openssl_key(const char *key_file, RSA **rsa, int private)