/* secSecretP.h - secSecret private header file */ /* * Copyright (c) 2015-2017, 2019, 2021 Wind River Systems, Inc. * * The right to copy, distribute, modify, or otherwise make use * of this software may be licensed only pursuant to the terms * of an applicable Wind River license agreement. */ #ifndef __INCsecSecretPh #define __INCsecSecretPh /* includes */ #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* defines */ #ifndef SEC_SECRET_PATH_MAX #define SEC_SECRET_PATH_MAX 128 #endif #define SEC_SECRET_TYPE_PKEY 1 #define SEC_SECRET_TYPE_TPM2_KEY 2 #define SEC_SECRET_TYPE_OPAQUE 4 #define SEC_SECRET_MODE_READ 1 #define SEC_SECRET_MODE_WRITE 2 /* Variables */ /* typedefs */ /* function declarations */ /******************************************************************************* * * secSecretOpen - open the database for reading * * This routine returns a handle that can be used to iterate all key IDs in the * database. Note that public keys and buffers/pre-shared keys have different * name spaces. * * RETURNS: A handle to be used in subsequent calls to secSecretRead * and secSecretClose. * NULL in case of error. * * ERRNO: */ void* secSecretOpen(void); /******************************************************************************* * * secSecretRead - return next key ID from the database * * This routine returns the next key ID from the database. * * Parameter: * \is * \i * handle returned from secSecretOpen * \i * buffer to store the key ID in * \i * length of name buffer * \ie * * RETURNS: * IPCOM_SUCCESS if successful * IPCOM_ERR_END if no more entries can be read * IPCOM_ERR_FAILED in case of error * * ERRNO: */ int secSecretRead(void* handle, char* name, int name_len); /******************************************************************************* * * secSecretClose - close handle * * This routine closes a handle used to iterate all key IDs in the * database. * * Parameter: * \is * \i * handle returned from secSecretOpen * \ie * * RETURNS: * OK if the handle was closed * ERROR if the handle could not be closed; * * ERRNO: */ int secSecretClose(void* handle); void* secSecretOpenDir(int type); void secSecretInit(const char* rootDir); int secSecretKepGet(char* buf, int* len); FILE* secSecretFpGet(const char* keyId, int type, int mode); void secSecretLock(void); void secSecretUnlock(void); STATUS secSecretGetDirPath(const int type, char* filePath, size_t pathLen); STATUS secSecretGetFilePath(const char* keyId, const int type, char* filePath, size_t pathLen); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __INCsecSecretPh */