def ccm.checks.nonce
import bend-osdev-cipher-modes@0.1.0.0/ccm.bend as Ccmimport Base
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M
113def ccm.checks.nonce(ok: Bool, +nl: Nat, +n: Nat) -> Result<&2, &2, M.CmError, Unit>:
114 match ok:
115 case True{}:
116 ccm.checks.len(ccm.len_ok(Nat.sub(15n, nl), n), n)
117 case False{}:
118 Fail{M.CmBadNonceLength{nl}}