MySQL  8.0.26
Source Code Documentation
keyring_operations_helper.h
Go to the documentation of this file.
1 /* Copyright (c) 2021, Oracle and/or its affiliates.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6 
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef KEYRING_OPERATIONS_HELPER_INCLUDED
24 #define KEYRING_OPERATIONS_HELPER_INCLUDED
25 
29 #include "my_sys.h"
30 #include "scope_guard.h"
31 
33 
34 /**
35  Read secret from keyring
36 
37  Note: Memory for secert and secret_type must be freed by the caller
38 
39  @param [in] keyring_reader Handle to keyring_reader_with_status service
40  @param [in] secret_id Identifier for secret data
41  @param [in] auth_id Owner of secret data - nullptr for internal keys
42  @param [out] secret Output buffer for secret fetched from keyring
43  @param [out] secret_length Length of secret data
44  @param [out] secret_type Type of data
45  @param [out] psi_memory_key Memory key to be used to allocate memory for
46  secret and secret_type
47 
48  @returns status of reading secret
49  @retval -1 Keyring error
50  @retval 0 Key absent
51  @retval 1 Key present. Check output buffers.
52 */
53 int read_secret(SERVICE_TYPE(keyring_reader_with_status) * keyring_reader,
54  const char *secret_id, const char *auth_id,
55  unsigned char **secret, size_t *secret_length,
56  char **secret_type, PSI_memory_key psi_memory_key);
57 } // namespace keyring_operations_helper
58 
59 #endif /* KEYRING_OPERATIONS_HELPER_INCLUDED */
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:48
Common header for many mysys elements.
Definition: keyring_operations_helper.h:32
int read_secret(const mysql_service_keyring_reader_with_status_t *keyring_reader, const char *secret_id, const char *auth_id, unsigned char **secret, size_t *secret_length, char **secret_type, PSI_memory_key psi_memory_key)
Read secret from keyring.
Definition: keyring_operations_helper.cc:29
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:75