Skip to content

sha512.c: the copy >> 61 carry term in eos_sha512_update() is always zero #121

Description

@Kartikey1306

Symptom

core/sha512.c, eos_sha512_update(): ctx->bitlen[0] += (uint64_t)copy >> 61; is always zero. copy is clamped to 128 - ctx->buffer_len, so copy <= 128 and copy >> 61 == 0 on every iteration. The real 128-bit carry is already handled by the old_low comparison two lines above.

Not a defect — the digest is correct (RFC 8032 vectors and the SHA-512 KATs pass) — but the line reads as overflow handling and does nothing, which is the kind of thing a future reader preserves because they assume it matters.

Raised in review of #115; left out of that PR deliberately so the file stayed a byte-exact restoration of the previously reviewed blob (d9aa57c).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions