【问题标题】:Loading OpenSSL custom engine via openssl.conf file shows error通过 openssl.conf 文件加载 OpenSSL 自定义引擎显示错误
【发布时间】:2021-08-27 03:10:36
【问题描述】:

我有一个简单的 openssl 引擎,我想通过 openssl.conf 文件加载到 OpenSSL 中。我已经使用以下配置设置从源代码安装openssl-1.1.1c

./config --prefix=/opt/openssl -DOPENSSL_LOAD_CONF --openssldir=/opt/openssl

安装后$openssl version显示如下,

ss@ss:~$ openssl version
OpenSSL 1.1.1c  28 May 2019

之后,我将openssl.conf更改如下,

openssl_conf = openssl_def

[openssl_def]
engines = engine_section

[engine_section]
rsa-engine-new = rsa_section

[rsa_section]
engine_id = rsa-engine-new

进行这些更改后,openssl engine 命令会显示以下内容,

ss@ss:/opt/openssl$ openssl engine
rsa-engine-new
(rdrand) Intel RDRAND engine
(dynamic) Dynamic engine loading support
(rsa-engine-new) engine for testing 1
139904801769216:error:260AB089:engine routines:ENGINE_ctrl_cmd_string:invalid cmd name:crypto/engine/eng_ctrl.c:255:
139904801769216:error:260BC066:engine routines:int_engine_configure:engine configuration error:crypto/engine/eng_cnf.c:141:section=rsa_section, name=oid_section, value=new_oids
139904801769216:error:0E07606D:configuration file routines:module_run:module initialization error:crypto/conf/conf_mod.c:177:module=engines, value=engine_section, retcode=-1      

知道我做错了什么吗?

【问题讨论】:

  • 您的 RSA 引擎的源代码中可能存在一些错误。关注第一条错误消息。
  • @DaniGrosu,感谢您的回复。使用我的引擎,我只是想提供描述服务。我想知道是否需要在 OpenSSL 引擎中实现一组通用功能,即使我的意图是只为引擎提供解密服务?我想我是在问OpenSSL引擎有没有共同的结构骨架?
  • @DaniGrosu,您能否提供 RSA 引擎的基本结构?我遵循了与openssl/engines/e_dasync.c 相同的结构。这是我的基本引擎结构rsa-engine.c。我添加了所有内容还是需要添加!ENGINE_set_destroy_function(e, dasync_destroy)!ENGINE_set_init_function(e, dasync_init)!ENGINE_set_finish_function(e, dasync_finish)

标签: openssl openssl-engine


【解决方案1】:

我从 OpenSSL 邮件列表中找到了解决方案。

发生的情况是,我将新配置放在 openssl.cnf 文件的开头。因此,我有 main openssl config 的残余。

然后我将以下部分移到openssl.cnf文件的末尾

[openssl_def]
engines = engine_section

[engine_section]
rsa-engine-new = rsa_section

[rsa_section]
engine_id = rsa-engine-new
dynamic_path = (PATH_TO_OPENSSL)/lib/engines-1.1/rsa-engine-new.so

并且引擎加载没有任何错误,

$openssl engine
(rdrand) Intel RDRAND engine
(dynamic) Dynamic engine loading support
(rsa-engine-new) engine for testing 1

【讨论】:

    猜你喜欢
    • 2020-10-12
    • 2015-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多