FHERMA
L2 · OPERATIONMEASURED

Encrypted Sign Extension

encrypted-signextend · spec v0.1.0 · 0 implementations · 6 runners

Create implementationSpecification

DESCRIPTION

Extends a two-complement integer of k+1 bytes to the full word width, replicating its sign bit, where both the value and the width are encrypted.

It needs the sign bit, and the sign bit is a bit — which puts this opcode on top of bit extraction rather than beside it. The width being encrypted turns the fill into a selection over possible widths.

INTERFACE

encrypted_signextend(
  in  ct     : Ciphertext  // the encrypted first operand
  in  ct_k   : Ciphertext  // the encrypted byte width minus one
  out ct     : Ciphertext  // the encrypted result of the opcode
  ...               // anything else the realization needs — keys, context, encoding — is its own concern
)

PARAMETER SCHEMA

NAMETYPERANGE
word_maxinteger255 – 2^32
target_precisionnumber0.5 – 1

The schema belongs to the kernel. Each implementation declares which part of it it supports.

CORRECTNESS

01A value whose sign bit is set is filled with ones above its width; otherwise with zeros.
02A width at or above the word size returns the operand unchanged.
03The result matches the EVM definition of the opcode exactly, including its behaviour at the boundaries.

An opcode is exact by definition. Where the scheme is approximate, the precision threshold is what stands in for exactness, and it has to hold at every integer in range.

SECURITY PROPERTIES

Operands and result stay encrypted throughout. Nothing about the values may be observable through timing or control flow, which rules out any realization that branches on a decrypted intermediate.

ASSUMPTIONS

Operands are integers held exactly at the point of encryption.

REFERENCES

Encrypted Sign Extension · FHERMA