Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

openssl_sign() cannot sign a precomputed digest

オープン
#23,422 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, php

調査の方向性

PHP の ext/openssl にある openssl_sign() エントリポイントから開始し、現在のダイジェスト処理の動作を、言及されている EVP_PKEY_sign() および EVP_PKEY_verify() API と比較します。署名と検証の両方をカバーする、事前計算済み入力用のインターフェースを決定します。呼び出し側が既存のダイジェストを再度ハッシュせずに署名および検証できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Bug Extension: openssl Status: Verified
Description

Description

openssl_sign() currently always performs the digest operation internally before signing the data.

This causes a problem when the input is already a precomputed digest.

For example, when a SHA-256 digest is passed to openssl_sign() together with OPENSSL_ALGO_SHA256, the digest is hashed again:

signature = sign(SHA256(precomputed_sha256_digest))

instead of signing the existing digest directly:

signature = sign(precomputed_sha256_digest)

As a result, PHP currently has no straightforward way to sign an already computed digest using ext/openssl.

Expected behavior

It should be possible to pass a precomputed digest to the OpenSSL extension and sign it directly without applying another hashing operation.

The same should be possible for verification of a signature over a precomputed digest.

Actual behavior

openssl_sign() combines hashing and signing. Therefore, when the caller already has the digest, an additional hashing operation is performed.

Additional information

OpenSSL provides lower-level APIs such as EVP_PKEY_sign() and EVP_PKEY_verify() that can operate on already prepared input.

PHP's OpenSSL extension currently does not expose an equivalent way to perform this operation.

PHP Version
PHP 8.5
Operating System

all

主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 17時間
マージ済み PR(30日)
115

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

php/php-src のほかの issue

php/php-src の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。