PoprfServer::evaluate(input, None) disagrees with interactive POPRF finalization for empty public info

Open Beginner friendly
#166 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cryptography

Research direction

Start by locating PoprfServer::evaluate and the server_evaluate_hash_input helper mentioned in the issue, then compare how they handle None and Some(&[]). Use the supplied regression test and check both direct evaluation paths against interactive finalization; done means all three produce the same PRF output for empty public info.

Written by the indexing model from the issue text.

Description

When the public info is empty, PoprfServer::evaluate(input, None) returns a different PRF output from the interactive POPRF protocol for the same key and private input. Passing Some(&[]) to evaluate produces the same output as interactive finalization.

Here is a minimal regression test that fails on the commit 701b57f.

use voprf::{PoprfServer, Ristretto255};

#[test]
fn empty_poprf_info_has_a_consistent_output() {
    let server = PoprfServer::<Ristretto255>::new_from_seed(&[0x53; 32], b"test").unwrap();
    let input = b"example input";

    let implicit_empty = server.evaluate(input, None).unwrap();
    let explicit_empty = server.evaluate(input, Some(&[])).unwrap();

    assert_eq!(implicit_empty, explicit_empty);
}
Expected behavior

RFC 9497 §3.3.3 includes I2OSP(len(info), 2) || info in the final hash input for both Evaluate and Finalize. For empty info, this contributes two zero bytes. Both API representations of empty info should therefore agree with interactive finalization.

Cause and suggested fix

The POPRF server treats None as empty when computing the key tweak, then passes the original Option to server_evaluate_hash_input. That helper appends the length and contents of info only for Some, so the None path omits the two-byte length. Interactive finalization normalizes None to an empty slice and includes the length.

A localized fix would be to pass Some(info.unwrap_or_default()) to the shared hash helper from PoprfServer::evaluate. A regression test comparing both direct calls with interactive finalization would cover all three paths.

Dominant language
Rust
Stars
88
Forks
22
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebook/voprf

All issues in facebook/voprf

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.