Check consistency of OpenSSL data headers
@picnixz 已经在做这个了。
开始于 2025年4月20日。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Feature or enhancement
Proposal:
OpenSSL mnemonics may change in minor releases and/or they may have clashes. Clashes are annoying because we cannot build 1-to-1 hash tables out of it while inconsistencies mean that error messages would be incorrectly rendered. Note that only error reporting is affected but not error handling as code paths are using the macros defined by OpenSSL (so it doesn't matter which version we're using, as soon as they are available)
I want to create a tool that checks the OpenSSL mnemonics themselves to see if there are duplicates for instance, as well as a tool that bisects whether the latest OpenSSL version has changed its mnemonics. Currently, _ssl.c contains this:
/* Include generated data (error codes) */
/* See make_ssl_data.h for notes on adding a new version. */
#if (OPENSSL_VERSION_NUMBER >= 0x30100000L)
#include "_ssl_data_34.h"
#elif (OPENSSL_VERSION_NUMBER >= 0x30000000L)
#include "_ssl_data_300.h"
#elif (OPENSSL_VERSION_NUMBER >= 0x10101000L)
#include "_ssl_data_111.h"
#else
#error Unsupported OpenSSL version
#endif
In other words, we make the assumption that error codes from OpenSSL 3.1.x up to now have not been changed, but this is not necessarily correct (if new codes are added, it's fine, but if mnemonics are renumbered, it's not: this happened in 3.4.0 -> 3.4.1).
In addition, the reason why 3.4.1 mnemonics changed is because there were mismatched values (see https://github.com/openssl/openssl/issues/26388). The tool would then be doing the following:
- check whether OpenSSL mnemonics are valid after pulling them; namely check that we don't have mismatched values or clashing values.
- compute the diff between the latest known mnemonics and the pulled mnemonics. If there are more entries, we can use the same file; otherwise a new file must be created.
To ease development, I also suggest a separate _ssl_data.h file, also automatically generated, and that would be responsible to hold the above code snippet. It's easier than adding more and more lines to _ssl.c in the future. I also suggest moving the _ssl_data_* files into a dedicated folder as we may have more and more files in the future.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。