Line data Source code
1 : /* 2 : * Copyright (C) 2000-2016 Free Software Foundation, Inc. 3 : * Copyright (C) 2016-2017 Red Hat, Inc. 4 : * 5 : * Author: Nikos Mavrogiannopoulos 6 : * 7 : * This file is part of GnuTLS. 8 : * 9 : * The GnuTLS is free software; you can redistribute it and/or 10 : * modify it under the terms of the GNU Lesser General Public License 11 : * as published by the Free Software Foundation; either version 2.1 of 12 : * the License, or (at your option) any later version. 13 : * 14 : * This library is distributed in the hope that it will be useful, but 15 : * WITHOUT ANY WARRANTY; without even the implied warranty of 16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 : * Lesser General Public License for more details. 18 : * 19 : * You should have received a copy of the GNU Lesser General Public License 20 : * along with this program. If not, see <https://www.gnu.org/licenses/> 21 : * 22 : */ 23 : 24 : #ifndef GNUTLS_LIB_CRYPTO_API_H 25 : #define GNUTLS_LIB_CRYPTO_API_H 26 : 27 : #include <gnutls_int.h> 28 : 29 : inline static 30 23457 : int _gnutls_aead_cipher_init(gnutls_aead_cipher_hd_t handle, 31 : gnutls_cipher_algorithm_t cipher, 32 : const gnutls_datum_t * key) 33 : { 34 23457 : const cipher_entry_st* e; 35 : 36 23457 : e = cipher_to_entry(cipher); 37 23457 : if (e == NULL || e->type != CIPHER_AEAD) 38 0 : return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); 39 : 40 23457 : return 41 23457 : _gnutls_cipher_init(&handle->ctx_enc, e, key, 42 : NULL, 1); 43 : } 44 : 45 : inline static 46 23423 : void _gnutls_aead_cipher_deinit(gnutls_aead_cipher_hd_t handle) 47 : { 48 23423 : api_aead_cipher_hd_st *h = handle; 49 : 50 23964 : _gnutls_cipher_deinit(&h->ctx_enc); 51 : } 52 : 53 : #endif /* GNUTLS_LIB_CRYPTO_API_H */