1111#include <assert.h>
1212#include <openssl/rand.h>
1313
14- typedef struct KeyProviders
14+ typedef struct RegisteredKeyProviderType
1515{
1616 TDEKeyringRoutine * routine ;
1717 ProviderType type ;
18- } KeyProviders ;
18+ } RegisteredKeyProviderType ;
1919
2020#ifndef FRONTEND
21- static List * registeredKeyProviders = NIL ;
21+ static List * registeredKeyProviderTypes = NIL ;
2222#else
23- static SimplePtrList registeredKeyProviders = {NULL , NULL };
23+ static SimplePtrList registeredKeyProviderTypes = {NULL , NULL };
2424#endif
2525
26- static KeyProviders * find_key_provider (ProviderType type );
26+ static RegisteredKeyProviderType * find_key_provider_type (ProviderType type );
2727static void KeyringStoreKey (GenericKeyring * keyring , KeyInfo * key );
2828static KeyInfo * KeyringGenerateNewKey (const char * key_name , unsigned key_len );
2929
3030#ifndef FRONTEND
31- static KeyProviders *
32- find_key_provider (ProviderType type )
31+ static RegisteredKeyProviderType *
32+ find_key_provider_type (ProviderType type )
3333{
3434 ListCell * lc ;
3535
36- foreach (lc , registeredKeyProviders )
36+ foreach (lc , registeredKeyProviderTypes )
3737 {
38- KeyProviders * kp = (KeyProviders * ) lfirst (lc );
38+ RegisteredKeyProviderType * kp = (RegisteredKeyProviderType * ) lfirst (lc );
3939
4040 if (kp -> type == type )
4141 {
@@ -45,14 +45,14 @@ find_key_provider(ProviderType type)
4545 return NULL ;
4646}
4747#else
48- static KeyProviders *
49- find_key_provider (ProviderType type )
48+ static RegisteredKeyProviderType *
49+ find_key_provider_type (ProviderType type )
5050{
5151 SimplePtrListCell * lc ;
5252
53- for (lc = registeredKeyProviders .head ; lc ; lc = lc -> next )
53+ for (lc = registeredKeyProviderTypes .head ; lc ; lc = lc -> next )
5454 {
55- KeyProviders * kp = (KeyProviders * ) lc -> ptr ;
55+ RegisteredKeyProviderType * kp = (RegisteredKeyProviderType * ) lc -> ptr ;
5656
5757 if (kp -> type == type )
5858 {
@@ -64,9 +64,9 @@ find_key_provider(ProviderType type)
6464#endif /* !FRONTEND */
6565
6666void
67- RegisterKeyProvider (const TDEKeyringRoutine * routine , ProviderType type )
67+ RegisterKeyProviderType (const TDEKeyringRoutine * routine , ProviderType type )
6868{
69- KeyProviders * kp ;
69+ RegisteredKeyProviderType * kp ;
7070#ifndef FRONTEND
7171 MemoryContext oldcontext ;
7272#endif
@@ -75,29 +75,29 @@ RegisterKeyProvider(const TDEKeyringRoutine *routine, ProviderType type)
7575 Assert (routine -> keyring_get_key != NULL );
7676 Assert (routine -> keyring_store_key != NULL );
7777
78- kp = find_key_provider (type );
78+ kp = find_key_provider_type (type );
7979 if (kp )
8080 ereport (ERROR ,
8181 (errmsg ("Key provider of type %d already registered" , type )));
8282
8383#ifndef FRONTEND
8484 oldcontext = MemoryContextSwitchTo (TopMemoryContext );
8585#endif
86- kp = palloc_object (KeyProviders );
86+ kp = palloc_object (RegisteredKeyProviderType );
8787 kp -> routine = (TDEKeyringRoutine * ) routine ;
8888 kp -> type = type ;
8989#ifndef FRONTEND
90- registeredKeyProviders = lappend (registeredKeyProviders , kp );
90+ registeredKeyProviderTypes = lappend (registeredKeyProviderTypes , kp );
9191 MemoryContextSwitchTo (oldcontext );
9292#else
93- simple_ptr_list_append (& registeredKeyProviders , kp );
93+ simple_ptr_list_append (& registeredKeyProviderTypes , kp );
9494#endif
9595}
9696
9797KeyInfo *
9898KeyringGetKey (GenericKeyring * keyring , const char * key_name , KeyringReturnCodes * returnCode )
9999{
100- KeyProviders * kp = find_key_provider (keyring -> type );
100+ RegisteredKeyProviderType * kp = find_key_provider_type (keyring -> type );
101101
102102 if (kp == NULL )
103103 {
@@ -112,7 +112,7 @@ KeyringGetKey(GenericKeyring *keyring, const char *key_name, KeyringReturnCodes
112112static void
113113KeyringStoreKey (GenericKeyring * keyring , KeyInfo * key )
114114{
115- KeyProviders * kp = find_key_provider (keyring -> type );
115+ RegisteredKeyProviderType * kp = find_key_provider_type (keyring -> type );
116116
117117 if (kp == NULL )
118118 ereport (ERROR ,
0 commit comments