def checked_nonce

qasim-bend-kit@0.1.0.2 · proof/AES_EncryptProof.bend:428

import qasim-bend-kit@0.1.0.2/proof/AES_EncryptProof.bend as AESEncryptProof
import Base
import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES

428def checked_nonce(key: AES.SecretKey, +nonce: AES.Nonce,
429    +aad: List<&2, U32>, +plaintext: List<&2, U32>,
430    aad_ok: Bool, plaintext_ok: Bool) ->
431    {result_nonce(nonce, AES.encrypt_checked(key, nonce, aad, plaintext,
432        aad_ok, plaintext_ok)) == nonce : AES.Nonce}:
433    match aad_ok plaintext_ok:
434        case True{} True{}: valid_nonce(key, nonce, aad, plaintext)
435        case False{} _: {==}
436        case True{} False{}: {==}

Uses (8)

Used by (1)