Compile encrypted SystemVerilog IP, and encrypt your own IP for RyuSim with ryusim-protect.
IEEE 1735 defines how an IP vendor ships HDL source encrypted, so that only the tools the
vendor chose can read it. The source carries `pragma protect envelopes: the
design text encrypted with a random AES session key, and that session key encrypted
(wrapped) with each tool's RSA public key.
RyuSim does not ship the RSA private key that unwraps its session keys. Seiraiyu's key
broker holds it. When a source file contains an envelope, ryusim compile sends
the wrapped session key to the broker over HTTPS, gets the session key back, decrypts the
design in memory and compiles it. Keeping the private key off the user's machine answers the
key-extraction attacks that Speith et al. showed against local key storage
(IEEE S&P 2022).
Every compile of protected source needs network access to the broker. There is no offline mode.
Pass the encrypted file like any other source. No extra option is needed:
ryusim compile --top pipelined_adder pipelined_adder.svp
RyuSim checks every source file for protected regions, whatever its extension.
.svp is a convention. The broker URL defaults to
https://broker.ryusim.com/api/v2; --broker-url changes it, and
ryusim -v compile prints the one in use. RyuSim trusts the broker's TLS
certificate through the system trust store; --broker-ca-file names a PEM file
of CA certificates to trust instead, for a private broker with its own CA. If the
RYUSIM_API_KEY environment variable is set, RyuSim sends it to the broker as a
bearer token. The public broker does not require one.
In a cocotb flow, list the .svp file in VERILOG_SOURCES. The
cocotb guide covers the rest.
This file is encrypted for RyuSim. The ports and the parameter are plaintext; the body is
not. Save it as pipelined_adder.svp:
module pipelined_adder #(
parameter WIDTH = 8
) (
input logic clk,
input logic rst,
input logic [WIDTH-1:0] a,
input logic [WIDTH-1:0] b,
output logic [WIDTH:0] sum,
output logic valid
);
`pragma protect version = 2
`pragma protect encrypt_agent = "ryusim-protect"
`pragma protect key_keyowner = "Seiraiyu"
`pragma protect key_keyname = "RyuSim-RSA-2026-02"
`pragma protect key_method = rsa
`pragma protect key_block
T4Qn4if1sgj6mT/lkQu1qn+XhWR94RtoHsgRIZeydyunqar38AG0BU5YuGxFXW3PBwvRiaStB2TijCYLmNdsgg4B28UHtn+VBQFIzQwX5pBwGwJBrWQEZuiRVD8/gAQudiNb70f3FQWJGBds3fYGWuNA65WAyuypRkp34GFndh7hsyEOkBcAoIBeSS9lOEr0ZDQ5VN4d9BCdW+f+djecmgKpUwS+ta90NkScr90awHMJMgRvYjKNDQ5lv6TT3sb4pW9SnsWcRLJR3mjQ4xEzcdEftj0hkKNKl4rTEVOj8ZNyIM+GOsAJfhZ9Yxaa6JiXKFakuCDAQ84U+y7fOZ4HJA==
`pragma protect data_method = "aes-256-gcm"
`pragma protect iv = "49b0669492b421f54980b525"
`pragma protect begin_protected
`pragma protect data_block
cYbDgWACuQeTH0Tjy4Tfi0MJFz2qB8Q/53w50zzaixow33dqG1sg4M0EYSx3P9ryIKbLjWfjdtjsC9u9MUQp5pZDy9WTTnF6/NWSC2EQQdi7nNN3zuq6LHAaJ0I139dtwHF8tZFdSeFXmtj18XclcefBv+ciodvo9YnYk3oDUl3efDEu9f4rnGkNjYTG6UkLIYnjIL8AJFMQ3lLpBYcVUi4wU8S/pKdvzMurDXOlHB2dGXT/yRu8maBPzmFhHtd3V76+TWWvHke11ub6G6kgu/5l7LGZ1ikExKe+3CMZBNED9VCiPzKwLHQbJLRJG2RgchWDivyEP104Xj5Fg1J78paEMEXx1zj/bWveO14da8rx3HCtvUlALRrdDmpILjMoGFcDopIGcJ0UnrV3YF50LHYxPqn3eaUO4BkreYRtwwAO8V/7v0ivJOfj6f0lqpk7M11r4hbV5KstxH+An2zNF9RstBR3HwRaQRQMNr5yRjKHUE/gOuKpYWss6aaodyKAafGopXvj3hLAn8FpQdMe83reJoblpBfCUDoK9ZlxhUhgIeWra04bWb8OFLDmHymNPz4xSdPENoYi041Od/JOWPYaHSd31o9dlg87tgZX00HlJY2kXPeYEEyt/mtuKKVQc/OU0ivdSTlmvde62iHkoTsbfLSpuMtjq8ae+rINxyB2
`pragma protect auth_tag = "eec616b0c69cb6353d1f47ef6f96962f"
`pragma protect end_protected
endmodule
Save a cocotb test as test_pipelined_adder.py:
import cocotb
from cocotb.triggers import RisingEdge, Timer
from cocotb.clock import Clock
@cocotb.test()
async def test_pipelined_add(dut):
"""Verify the encrypted pipelined adder compiles and simulates."""
cocotb.start_soon(Clock(dut.clk, 10, unit="ns").start())
# Reset
dut.rst.value = 1
dut.a.value = 0
dut.b.value = 0
for _ in range(3):
await RisingEdge(dut.clk)
dut.rst.value = 0
# Apply inputs and wait for pipeline to produce results
dut.a.value = 10
dut.b.value = 20
for _ in range(5):
await RisingEdge(dut.clk)
await Timer(1, unit="ns")
assert dut.valid.value == 1, "valid should be asserted after pipeline fill"
result = int(dut.sum.value)
assert result == 30, f"Expected 10+20=30, got {result}"
dut._log.info(f"Encrypted IP works! sum={result}")
and a Makefile:
SIM ?= ryusim
TOPLEVEL_LANG := verilog
VERILOG_SOURCES = $(PWD)/pipelined_adder.svp
COCOTB_TOPLEVEL = pipelined_adder
COCOTB_TEST_MODULES = test_pipelined_adder
include $(shell cocotbext-ryusim-config --makefiles)/Makefile.sim
Run make. The test passes:
71.00ns INFO cocotb.pipelined_adder Encrypted IP works! sum=30
...
** TESTS=1 PASS=1 FAIL=0 SKIP=0 71.00 0.00 84278.49 **
The blocks in this section are not run in the site's CI because they reach the broker over the network. The output above is from a run of the same design.
begin_protected … end_protected region:
the key blocks with their key_keyowner and key_keyname, the
data_method, the iv, the data_block and the
auth_tag.key_keyowner is Seiraiyu (a file with more than one such block
is refused rather than choosing between them) and checks that the
data_method is one it can decrypt. Both checks fail without any network
request.GET <broker-url>/challenge (by default
https://broker.ryusim.com/api/v2/challenge) and checks the signature against
the broker identity keys built into this RyuSim release; a server that cannot prove it is
the Seiraiyu broker gets nothing. It then sends
POST <broker-url>/unwrap the key block, signed together with the
challenge and a single-use ephemeral key by this release's own key. The broker checks the
signature and the release certificate, decrypts the key block with the RSA private key,
and returns the AES session key sealed to the ephemeral key, so the session key is never
transmitted in the clear and a relayed response cannot be opened. TLS certificate and
host verification are on, and RyuSim refuses a non-https:// broker URL up
front with a diagnostic. A failed unwrap stops the compile; there is no other path. Each
request has a 10-second connect timeout and a 30-second total timeout. Connection errors
and HTTP 5xx answers are retried, up to 3 attempts with a 2 s and then a 4 s pause. HTTP 4xx
answers are not retried.OPENSSL_cleanse. The parser keeps its own copy of the
source in memory until the compile process exits.obj_dir, compiled, and
deleted when the build succeeds (ryusim -v compile prints
Removed protected source: <file> for each). The object files stay in
obj_dir for linking. The module's generated header also stays; it names the
module's ports and internal signals.data_method | Status |
|---|---|
aes-256-gcm (also aes256-gcm) | Supported. 256-bit key, 96-bit IV, 128-bit authentication tag. A modified payload or tag fails the compile. This is what ryusim-protect writes. |
aes-128-cbc (also aes128-cbc) | Supported, with a warning: warning: <file> uses AES-128-CBC without integrity protection. CBC has no authentication tag, so tampering is not detected. |
| anything else | Rejected before the broker is contacted. |
ryusim-protect encrypts SystemVerilog for IEEE 1735 distribution. It is in
the bin/ directory of the release archive, next to ryusim, and the
installer puts it in the same place as ryusim. Its commands are
encrypt, validate, info,
list-recipients and keygen. The examples below ran with
this release's ryusim-protect. The site's CI does not run them, because its build
tree has no ryusim-protect.
Put `pragma protect begin and `pragma protect end (IEEE 1800-2023
clause 34.5) around the part to encrypt. Everything outside the markers stays plaintext:
the module header, ports, parameters, typedefs and defines. Users can then see the interface
and override parameters. Save this as my_ip.sv:
module my_ip #(
parameter int WIDTH = 8
) (
input logic clk,
input logic [WIDTH-1:0] data_in,
output logic [WIDTH-1:0] data_out
);
`pragma protect begin
always_ff @(posedge clk)
data_out <= data_in + 1'b1;
`pragma protect end
endmodule
ryusim-protect encrypt --input my_ip.sv --output my_ip.svp --recipient ryusim
Encrypted my_ip.sv -> my_ip.svp (1 recipient(s))
The result keeps the plaintext header and replaces the marked region with the envelope.
The session key, IV and ciphertext are random, so every run gives a different file. This is
one such my_ip.svp; the error examples further down use it:
module my_ip #(
parameter int WIDTH = 8
) (
input logic clk,
input logic [WIDTH-1:0] data_in,
output logic [WIDTH-1:0] data_out
);
`pragma protect version = 2
`pragma protect encrypt_agent = "ryusim-protect"
`pragma protect key_keyowner = "Seiraiyu"
`pragma protect key_keyname = "RyuSim-RSA-2026-02"
`pragma protect key_method = rsa
`pragma protect key_block
d6aQkwAEaG/jugTwOhuOEJVx4gjzybju7PETxO7n0uY8md1UZAcwyjw5ZbpUESv2lwHxE25t5zuQJnsQfVbCvG99zh9pTC/V9Xv+cJ1uM2HGXSzr98QgJsk0dD2avzzFBhYsrRDEschUMFmAZinTxX161fOyNgEvI06CpHsD1mWodWW2izyXTyDVN+L9ys0cHKyfwznRPj22TPPNZ5q5osPCroJLgKPoD9x2qJ5BZfORgsr4cSqfle2yAhBLdxJB8SPuPT130sxE0a897UXgxcxxFro33ZcQqCHxJ8ucb0QZ5cSZOAq7pI7BRd9thL5gvmpUrhTRQlJBeEQ6chF2Rw==
`pragma protect data_method = "aes-256-gcm"
`pragma protect iv = "8b48ebbaa7f729ff9ff4cec4"
`pragma protect begin_protected
`pragma protect data_block
wasOuasn5mJ21yvIhuVT3Euj875YKLdtOcA3bjHfXV73Kt73wK/OP9f6Qi0ptIhZMfblI2L5ipsEYo6g58xlAAU=
`pragma protect auth_tag = "27d87b26cb10cf9f73d63f78e86690c3"
`pragma protect end_protected
endmodule
ryusim-protect always encrypts with AES-256-GCM and wraps the session key
with RSA-OAEP (SHA-256). Its --data-method option changes only the
data_method label written into the envelope, not the cipher, so a file written
with --data-method aes-128-cbc does not compile. Leave the option at its default
(aes-256-gcm).
--recipient names a tool by its registry ID. Give it more than once to encrypt
one file for several tools. Each recipient gets its own key block holding the same session
key, wrapped with that tool's public key; the data block is shared. Removing a recipient
means encrypting again.
ryusim-protect list-recipients
Known Vendor Recipients:
Vendor Key Owner Key Name Notes
------------------------------------------------------------------------------------------
ryusim Seiraiyu RyuSim-RSA-2026-02 RyuSim's own key
vivado Xilinx xilinxt_2019_11 AMD/Xilinx Vivado
questa Mentor Graphics Corporation MGC-VERIF-SIM-RSA-2 Siemens Questa
quartus Altera Corporation Altera-Quartus-RSA-1 Intel Quartus
vcs Synopsys SNPS-VCS-RSA-2 Synopsys VCS
xcelium Cadence Design Systems. CDS-RSA-KEY-VER-1 Cadence Xcelium
Only RyuSim's public key ships with RyuSim. For another registry ID,
ryusim-protect looks for <Key Owner>_<Key Name>_public.pem
in the ieee1735/ directory next to its bin/ and in
~/.ryusim/ieee1735/, and stops if the file is not there:
Error: Public key for 'vivado' not found. Searched:
...
For non-RyuSim recipients, use --recipient-key with the vendor's public key file.
Get the vendor's public key from the vendor, then either copy it to that name in
~/.ryusim/ieee1735/ or give it directly with --recipient-key,
--recipient-owner and --recipient-name (one of each per
recipient):
ryusim-protect encrypt --input my_ip.sv --output my_ip.svp \
--recipient ryusim \
--recipient-key Xilinx_xilinxt_2019_11_public.pem \
--recipient-owner Xilinx --recipient-name xilinxt_2019_11
ryusim-protect keygen --key-owner <owner> --key-name <name> writes an
RSA-2048 key pair (<owner>_<name>_private.pem and
<owner>_<name>_public.pem) for testing a flow with your own key.
validate checks that every required envelope field is present. It does not
decrypt anything or check the base64 data.
ryusim-protect validate my_ip.svp
VALID: All required envelope fields present.
A file with fields missing prints INVALID: Missing required fields: … and
exits with status 1. info prints the envelope metadata, including every key
owner, so you can see which tools a file was encrypted for:
ryusim-protect info my_ip.svp
Version: 2
Encrypt Agent: ryusim-protect
Data Method: aes-256-gcm
Key Owners (1):
- Seiraiyu
Key Names (1):
- RyuSim-RSA-2026-02
IV: 8b48ebbaa7f729ff9ff4cec4
| Threat | What RyuSim does |
|---|---|
Opening the .svp in an editor | The body is AES-encrypted. |
| Extracting the private key from the simulator | RyuSim does not contain it. The broker unwraps session keys server-side. |
| Padding-oracle attacks and modified payloads | AES-256-GCM rejects a modified payload or tag. Files using AES-128-CBC get no such check. |
| Generated C++ left on disk | The .cpp files of protected modules are deleted after a successful build. Their headers and object files remain. |
| Decrypted source left in memory | RyuSim zeroes its working copies. The parser's copy lives until the compile process exits. |
| Abuse of the broker | The broker rate-limits unwrap requests per client address. It unwraps only for a request signed by a RyuSim release it recognizes, for keys its policy allows that release. |
| A compromised key | Keys are versioned by name (RyuSim-RSA-2026-02), and the broker can hold more than one at once. |
ryusim compile can read the decrypted source from
memory, and the design from the parsed and intermediate forms after that.The messages below are printed by ryusim compile, which then prints
Error: Compilation failed and exits with status 1.
error: no IEEE 1735 key block for key_owner="Seiraiyu" in <file>The file was encrypted for other tools but not for RyuSim. ryusim-protect info
lists the key owners it has. Ask the IP vendor for a file encrypted with
--recipient ryusim. The check runs before any network request, so this
reproduces offline:
sed 's/key_keyowner = "Seiraiyu"/key_keyowner = "Acme"/' my_ip.svp > acme.svp
ryusim compile --top my_ip acme.svp 2>&1 || true
error: unsupported data_method "<method>" in <file>The envelope names a cipher RyuSim does not decrypt (see Data
methods). Ask the vendor for an aes-256-gcm file. Also checked before any
network request:
sed 's/data_method = "aes-256-gcm"/data_method = "des-cbc"/' my_ip.svp > des.svp
ryusim compile --top my_ip des.svp 2>&1 || true
fatal: v2 challenge failed: cannot reach broker (<reason>)No attempt reached the broker. The reason in parentheses comes from libcurl: a DNS failure,
a refused or timed-out connection (a firewall that blocks HTTPS on port 443), or a TLS
certificate that did not verify. Check the network, the proxy settings and
--broker-url. curl -s https://broker.ryusim.com/health shows whether
the broker is up. Behind a proxy that inspects TLS, add the proxy's CA certificate to the
system trust store, or pass it with --broker-ca-file. RyuSim tries three times,
about 6 seconds in all when the connection is refused, as with this unused local port:
ryusim compile --top my_ip --broker-url https://127.0.0.1:9/api/v2 my_ip.svp 2>&1 || true
fatal: v2 challenge failed: cannot reach broker (Couldn't connect to server)
Error: Compilation failed
fatal: broker returned HTTP <code>: <body>The broker answered but refused. The JSON body names the reason:
policy_denied (this RyuSim build may not unwrap that key; the file is encrypted to a
key this release does not accept), revoked (this build's release key was revoked;
upgrade RyuSim), unknown_key (the broker does not hold the key named in the
envelope), or bad_nonce (retry). HTTP 429 means the rate limit was hit; the body
says how many seconds to wait. If it persists, contact Seiraiyu support.
fatal: broker identity verification failedThe server at --broker-url did not prove it is the Seiraiyu broker this build
trusts. RyuSim refuses to send it anything. Check that --broker-url is not
overridden to an unknown host.
fatal: integrity check failed for encrypted IP in <file> — file may be tamperedThe AES-256-GCM tag does not match: the file changed after it was encrypted, through corruption in transfer or on purpose. Download it again, compare its SHA-256 checksum if the vendor publishes one, and transfer it in binary mode (not FTP ASCII mode). If it still fails, contact the IP vendor. This check runs after the broker returns the session key.
error: <file>:<line>: malformed IEEE 1735 envelope — missing key_block and data_blockA protected region ends without a key block or a data block. A region that never ends
gives error: <file>: unterminated pragma protect region. Run
ryusim-protect validate <file> to see which fields are missing, and get the
file from the vendor again.
For encrypted SystemVerilog to compile in RyuSim, its envelope needs a key block with
key_keyowner="Seiraiyu" and key_keyname="RyuSim-RSA-2026-02",
wrapped with RyuSim's public key. The release archive's ieee1735/ directory
(installed to <prefix>/ieee1735/) holds:
Seiraiyu_RyuSim-RSA-2026-02_public.pem: the RSA-2048 public key in PEM
format.ryusim_ieee1735.json: the same facts, machine-readable:{
"tool": "RyuSim",
"vendor": "Seiraiyu",
"key_owner": "Seiraiyu",
"key_name": "RyuSim-RSA-2026-02",
"key_method": "rsa",
"key_size": 2048,
"supported_data_methods": ["aes-256-gcm", "aes-128-cbc"],
"supported_languages": ["verilog", "systemverilog"],
"public_key_file": "Seiraiyu_RyuSim-RSA-2026-02_public.pem",
"broker_url": "https://broker.ryusim.com/api/v2"
}
Use aes-256-gcm as the data_method.
To add your tool to the ryusim-protect list-recipients registry, email
ip-protection@seiraiyu.com with the tool and
vendor name, the key_keyowner and key_keyname strings your tool
expects, and your RSA public key in PEM format. Seiraiyu checks the key by encrypting a test
file that your tool must decrypt, then adds the tool in the next release.