Skip to content

ChaCha20With64BitNonce.stream uses wrong type for counter parameter #20732

@yanchan09

Description

@yanchan09

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

Try to compile code that uses std.crypto.stream.chacha.ChaCha20With64BitNonce.stream:

  1. counter parameter is u32 not u64
  2. As a result, you also get a compile error from std:
/usr/lib/zig/std/crypto/chacha20.zig:607:50: error: type 'u5' cannot represent integer value '32'
            c[1] = @as(u32, @truncate(counter >> 32));
                                                 ^~

Expected Behavior

ChaCha20With64BitNonce.stream should have counter: u64 parameter like .xor does

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions