def valid_input_is_done

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

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

624def valid_input_is_done(+key: AES.SecretKey, +nonce: AES.Nonce,
625    +aad: List<&2, U32>, +plaintext: List<&2, U32>,
626    aad_ok: {AES.aad_valid(aad) == True{} : Bool},
627    plaintext_ok: {AES.plaintext_valid(plaintext) == True{} : Bool}) ->
628    {Result.is_done(&2, &2, AES.Error, AES.Envelope,
629        AES.encrypt(key, nonce, aad, plaintext)) == True{} : Bool}:
630    Equal.trans(Bool,
631        Result.is_done(&2, &2, AES.Error, AES.Envelope,
632            AES.encrypt(key, nonce, aad, plaintext)),
633        Result.is_done(&2, &2, AES.Error, AES.Envelope,
634            AES.encrypt_checked(key, nonce, aad, plaintext,
635                True{}, AES.plaintext_valid(plaintext))),
636        True{},
637        Equal.cong(Bool, Bool,
638            b => Result.is_done(&2, &2, AES.Error, AES.Envelope,
639                AES.encrypt_checked(key, nonce, aad, plaintext,
640                    b, AES.plaintext_valid(plaintext))),
641            AES.aad_valid(aad), True{}, aad_ok),
642        Equal.trans(Bool,
643            Result.is_done(&2, &2, AES.Error, AES.Envelope,
644                AES.encrypt_checked(key, nonce, aad, plaintext,
645                    True{}, AES.plaintext_valid(plaintext))),
646            Result.is_done(&2, &2, AES.Error, AES.Envelope,
647                AES.encrypt_valid(key, nonce, aad, plaintext)),
648            True{},
649            Equal.cong(Bool, Bool,
650                b => Result.is_done(&2, &2, AES.Error, AES.Envelope,
651                    AES.encrypt_checked(key, nonce, aad, plaintext,
652                        True{}, b)),
653                AES.plaintext_valid(plaintext), True{}, plaintext_ok),
654            valid_is_done(key, nonce, aad, plaintext)))

Uses (16)

Used by (1)