Skip to content
SDKs · Client

Every status the native SDKs return

RH_STATUS is the whole diagnostic surface of the native client SDKs — they emit no log messages. Branch on the symbol; each one names a different next action.

This is a different surface from the API's errors

These are library return values, handed back to your process by code you linked. They are not what the Shield API returns to your backend over HTTP — that is a string error value, documented on the API reference. Both are stable contracts; they just live at different layers.

In both cases the stable identifier is the symbol, not the number. The integers below are an artifact of a C enum — useful when you are staring at a debugger, but the symbol is what you branch on and what support will ask you for.

The SDK does not log

There is no log callback and no log level. A static archive gets linked into your signed binary, and shipping our prose inside it helps nobody: you cannot route it, filter it, or correlate it with your own events. The status code is the diagnosis, and it is yours to log in your own stack.

char evidence[64 * 1024];
size_t evidence_len = 0;
RH_STATUS st = RootHeraldAttest(h, challenge, ak, ak_len,
                                evidence, sizeof evidence, &evidence_len);
if (st != RH_OK) {
    my_logger.warn("rootherald attest failed", {{"status", st}});
    return;
}

RootHeraldErrorString(status) exists and returns a short static English string. It is a convenience for a printf while you are integrating and for a CI harness's failure output — not a substitute for this page, and not something to show an end user.

Codes

CodeMeansDo
RH_OK
= 0
The call succeeded.For the buffer-filling calls, *out_len bytes are now in your buffer: relay a body to your backend, and keep each blob (the attestation key from EnrollBegin, an app key from MintKey) in your client's storage for as long as you want the key. There is nothing to free.
RH_ERR_INVALID_ARG
= 1
An argument is wrong: a NULL attestation key blob on a TPM platform, a blob of the wrong kind or format, a challenge string of the wrong form, Sign on a decrypt key, Decrypt on a sign key, a key handle where a session was expected.Fix the call site. Retrying with the same arguments cannot succeed, and a missing blob is never a reason to enroll.
RH_ERR_TPM_UNAVAILABLE
= 2
No TPM 2.0 or Secure Enclave is reachable on this host at all. A hardware ceiling, not a transient fault.Gate the feature off for this device and fall back to whatever you do for machines that cannot attest. Do not retry in a loop.
RH_ERR_NOT_ENROLLED
= 6 · EnrollComplete
This session holds no in-flight EnrollBegin state the leg needs.Start again from EnrollBegin. Attest, MintKey and Sign never return this: whether an installation is enrolled is whether your client still holds a blob that loads.
RH_ERR_ELEVATION_REQUIRED
= 7 · Windows only · EnrollComplete
EnrollComplete needs an elevated process and this one is not elevated. Nothing was consumed; the same call succeeds elevated. The SDK never elevates on your behalf.Run EnrollComplete from an elevated helper with the blob and the server's reply as its inputs. One elevation per enrollment; see the Windows elevation patterns reference. No other verb returns this.
RH_ERR_EK_READ_FAILED
= 8
A TPM is present, but its endorsement key could not be read. Distinct from TPM_UNAVAILABLE: the chip is there.Usually fixable on the machine. Check that a resource manager is running (tpm2-abrmd on Linux), that the process can open the TPM device, and that the driver is healthy.
RH_ERR_AK_FAILED
= 9 · EnrollBegin
Enrollment could not create the attestation key or read its storage parent. The device's TPM state is the problem, not your arguments.Retry enrollment once; then report it with the platform.
RH_ERR_ACTIVATION_FAILED
= 10 · EnrollComplete
The enrollment challenge could not be consumed — TPM2_ActivateCredential failed, or the enclave could not sign it.Restart from EnrollBegin. The credential is single-use and is now spent; retrying EnrollComplete with it will always fail.
RH_ERR_QUOTE_FAILED
= 11 · Attest
Reading PCRs or producing the quote failed after the attestation key loaded.Retry the challenge once; then report it. Keep the blob: the key loaded, so it is not the problem.
RH_ERR_ENTITLEMENT_MISSING
= 12 · macOS / iOS only
The host executable is not signed with a provisioning profile granting data-protection keychain access, so the Secure Enclave is unreachable from that binary (OSStatus -34018).Fix your build, not the device. Add the keychain-access-group entitlement and re-sign. An unsigned or ad-hoc-signed binary always fails this way, however healthy the hardware.
RH_ERR_ASK_UNSUPPORTED
= 13 · Attest, MintKey
A known ask this platform cannot answer ('posture' on macOS), or a key purpose this library does not know. A platform ceiling, not a fault. An ask name the library does not know is ignored: it collects what it can and the server appraises against its own row.Tell your backend, which will ask for less. Check RH_POSTURE.platform_name before asking for posture, and app_keys_supported before a key challenge, and you will never see this. Windows, Linux and macOS serve both sign and decrypt keys.
RH_ERR_KEY_UNLOADABLE
= 14 · Attest, MintKey, LoadKey, CheckKey
A blob no longer loads under its parent: the TPM was cleared, or the storage parent changed. The key is gone for good. Returned only when the TPM says the blob is dead; a transient TPM failure is a different code: QUOTE_FAILED from Attest, KEY_CREATE_FAILED from MintKey, and INTERNAL from LoadKey and CheckKey when the TPM answers a warning such as every object slot being held.For the attestation key blob: discard it, enroll again, retry once; the device ID does not change. For an app key blob: discard it and mint a new key. After a TPM clear, do both.
RH_ERR_KEY_CREATE_FAILED
= 15 · MintKey
TPM2_Create or TPM2_Certify failed for the new key after the attestation key loaded.Retry the key challenge once; then report it. The attestation key and the enrollment are unaffected.
RH_ERR_SIGN_FAILED
= 16 · Sign
The key is loaded but TPM2_Sign failed.Retry. A second failure means the TPM is wedged, not the key — surface it to the operator rather than discarding the blob.
RH_ERR_BUFFER_TOO_SMALL
= 17
Your buffer is NULL or smaller than the output. *out_len holds the size required. Nothing was written; where a call fills two buffers, both lengths are set and the TPM work is kept on the session.Not a fault. Allocate *out_len bytes and call again — the two-call size query is the intended way to size every buffer.
RH_ERR_DECRYPT_FAILED
= 18 · Decrypt
The envelope did not open under this key: the wrong key, a tampered envelope, or a header the library refuses. A refusal and a failed tag answer the same code, with nothing written.Not retriable with the same bytes. Ask your backend to encrypt again to the key it certified; keep the blob, the key is fine.
RH_ERR_INTERNAL
= 99
Nothing above fits — a condition the SDK does not have a name for. From LoadKey or CheckKey it is also the transient answer to a TPM warning, such as every object slot being held.From LoadKey or CheckKey: close a key, retry once, then report. Otherwise capture the call and the platform and open an issue on the SDK repository.

Retired and reserved codes

ABI 5.0 removed three codes, and they are never reused — a consumer built against an older header fails to compile rather than silently re-mapping onto a new meaning. ABI 6.0 renamed the prefix from ROOTHERALD_ to RH_ and kept every surviving value. ABI 8.1 added 18, RH_ERR_DECRYPT_FAILED, with RootHeraldDecrypt, and nothing else.

  • ROOTHERALD_ERR_NETWORK (3) and ROOTHERALD_ERR_QUOTA_EXCEEDED (5) — neither was ever returned by any platform. They described a direct-POST client removed in ABI 3.0. The client holds no key and opens no socket to RootHerald, so it cannot observe either condition.
  • ROOTHERALD_ERR_SERVER (4) — reachable, but misleading. It reported local TPM and crypto failures as "the server returned an error", which sent people to debug the wrong system. Its real causes are now ACTIVATION_FAILED and QUOTE_FAILED.

Which platforms return which

The enum is shared, and the header is byte-identical across sdk-windows, sdk-linux, sdk-macos and sdk-ios. Not every code is reachable everywhere: ELEVATION_REQUIRED is Windows-only, ENTITLEMENT_MISSING is Apple-only, EK_READ_FAILED and ACTIVATION_FAILED apply to the TPM platforms (macOS enrolls by signing a nonce with its enclave key rather than by credential activation), and ASK_UNSUPPORTED is what macOS says to a posture ask. KEY_UNLOADABLE and KEY_CREATE_FAILED come from the TPM platforms; SIGN_FAILED from every platform that mints keys, and DECRYPT_FAILED from the ones with Decrypt. Handle the ones your target platforms can produce; a default arm covers the rest.