| 1 | /************************************************************************************ |
| 2 | * |
| 3 | * D++, A Lightweight C++ library for Discord |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * Copyright 2021 Craig Edwards and D++ contributors |
| 7 | * (https://github.com/brainboxdotcc/DPP/graphs/contributors) |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | * This folder is a modified fork of libdave, https://github.com/discord/libdave |
| 22 | * Copyright (c) 2024 Discord, Licensed under MIT |
| 23 | * |
| 24 | ************************************************************************************/ |
| 25 | #include "cipher_interface.h"cxx . . $ `<file>/src/dpp/dave/cipher_interface.h`/ |
| 26 | #include "openssl_aead_cipher.h"cxx . . $ `<file>/src/dpp/dave/openssl_aead_cipher.h`/ |
| 27 | #include <dpp/cluster.h>cxx . . $ `<file>/include/dpp/cluster.h`/ |
| 28 | |
| 29 | namespace dppcxx . . $ dpp/::davecxx . . $ dpp/dave/ { |
| 30 | |
| 31 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<cipher_interfacecxx . . $ dpp/dave/cipher_interface#> create_ciphercxx . . $ dpp/dave/create_cipher(1723590a7f288f7c).(dppcxx . . $ dpp/::clustercxx . . $ dpp/cluster#& cl, const encryption_keycxx . . $ dpp/dave/encryption_key#& key) |
| 32 | { |
| 33 | auto cipher = stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<openssl_aead_ciphercxx . . $ dpp/dave/openssl_aead_cipher#>(cl, key); |
| 34 | return ciphercxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).is_validcxx . . $ dpp/dave/openssl_aead_cipher#is_valid(50ce9a9e25b4a850).() ? stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::movecxx . . $ std/move(e35c19a1ba7baa26).(cipher) : nullptrcxx . . $ std/unique_ptr#unique_ptr(6d988fd07f070dfc).; |
| 35 | } |
| 36 | |
| 37 | } |