/*** Copyright (C) 2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved. File: AuPinPair.cpp Date: 2024-10-14 Author: Reece ***/ #include #include "AuPinPair.hpp" namespace Aurora::Crypto::CA { OpAndPinner::OpAndPinner(const AuSPtr &pA, const AuSPtr &pB) : pA(pA), pB(pB) { } bool OpAndPinner::CheckCertificate(const AuSPtr &pChain, const AuMemoryViewRead &derCertificate) { return this->pA->CheckCertificate(pChain, derCertificate) && this->pB->CheckCertificate(pChain, derCertificate); } OpOrPinner::OpOrPinner(const AuSPtr &pA, const AuSPtr &pB) : pA(pA), pB(pB) { } bool OpOrPinner::CheckCertificate(const AuSPtr &pChain, const AuMemoryViewRead &derCertificate) { return this->pA->CheckCertificate(pChain, derCertificate) || this->pB->CheckCertificate(pChain, derCertificate); } AUKN_SYM IPinCertificate *PinCheckTwoAndNew(const AuSPtr &pCheckA, const AuSPtr &pCheckB) { SysCheckArgNotNull(pCheckA, {}); SysCheckArgNotNull(pCheckB, {}); return _new OpOrPinner(pCheckA, pCheckB); } AUKN_SYM void PinCheckTwoAndRelease(IPinCertificate *pHandle) { AuSafeDelete(pHandle); } AUKN_SYM IPinCertificate *PinCheckTwoOrNew(const AuSPtr &pCheckA, const AuSPtr &pCheckB) { SysCheckArgNotNull(pCheckA, {}); SysCheckArgNotNull(pCheckB, {}); return _new OpOrPinner(pCheckA, pCheckB); } AUKN_SYM void PinCheckTwoOrRelease(IPinCertificate *pHandle) { AuSafeDelete(pHandle); } }