本文整理汇总了C++中LTC_MUTEX_UNLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ LTC_MUTEX_UNLOCK函数的具体用法?C++ LTC_MUTEX_UNLOCK怎么用?C++ LTC_MUTEX_UNLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LTC_MUTEX_UNLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: added
/**
Register a hash with the descriptor table
@param hash The hash you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_hash(const struct ltc_hash_descriptor *hash)
{
int x;
LTC_ARGCHK(hash != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(<c_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (memcmp(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) {
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].name == NULL) {
XMEMCPY(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor));
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return -1;
}
示例2: added
/**
Register a PRNG with the descriptor table
@param prng The PRNG you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_prng(const struct ltc_prng_descriptor *prng)
{
int x;
LTC_ARGCHK(prng != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(<c_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (prng_descriptor[x].name == NULL) {
XMEMCPY(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor));
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return -1;
}
示例3: added
/**
Register a PRNG with the descriptor table
@param prng The PRNG you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_prng(const struct ltc_prng_descriptor *prng)
{
int x;
LTC_ARGCHK(prng != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(<c_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (prng_descriptor[x] == prng) {
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (prng_descriptor[x] == NULL) {
prng_descriptor[x] = prng;
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return -1;
}
示例4: register_cipher
int register_cipher(const struct ltc_cipher_descriptor *cipher)
{
int x;
LTC_ARGCHK(cipher != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(<c_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name != NULL && cipher_descriptor[x].ID == cipher->ID) {
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name == NULL) {
XMEMCPY(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor));
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return -1;
}
示例5: added
/**
Register a hash with the descriptor table
@param hash The hash you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_hash(const struct ltc_hash_descriptor *hash)
{
int x;
LTC_ARGCHK(hash != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(<c_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x] == hash) {
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x] == NULL) {
hash_descriptor[x] = hash;
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return -1;
}
示例6: hash_is_valid
/*
Test if a hash index is valid
@param idx The index of the hash to search for
@return CRYPT_OK if valid
*/
int hash_is_valid(int idx) {
LTC_MUTEX_LOCK(<c_hash_mutex);
if ((idx < 0) || (idx >= TAB_SIZE) || (hash_descriptor[idx].name == NULL)) {
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return CRYPT_INVALID_HASH;
}
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return CRYPT_OK;
}
示例7: prng_is_valid
/*
Test if a PRNG index is valid
@param idx The index of the PRNG to search for
@return CRYPT_OK if valid
*/
int prng_is_valid(int idx) {
LTC_MUTEX_LOCK(<c_prng_mutex);
if ((idx < 0) || (idx >= TAB_SIZE) || (prng_descriptor[idx].name == NULL)) {
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return CRYPT_INVALID_PRNG;
}
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return CRYPT_OK;
}
示例8: cipher_name
char* cipher_name(int idx)
{
LTC_MUTEX_LOCK(<c_cipher_mutex);
if (idx < 0 || idx >= TAB_SIZE || cipher_descriptor[idx].name == NULL) {
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return NULL;
}
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return cipher_descriptor[idx].name;
}
示例9: hash_is_valid
/*
Test if a hash index is valid
@param idx The index of the hash to search for
@return CRYPT_OK if valid
*/
int hash_is_valid(int idx)
{
LTC_MUTEX_LOCK(<c_hash_mutex);
if (idx < 0 || idx >= TAB_SIZE || hash_descriptor[idx] == NULL) {
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return CRYPT_INVALID_HASH;
}
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return CRYPT_OK;
}
示例10: cipher_is_valid
/*
Test if a cipher index is valid
@param idx The index of the cipher to search for
@return CRYPT_OK if valid
*/
int cipher_is_valid(int idx)
{
LTC_MUTEX_LOCK(<c_cipher_mutex);
if (idx < 0 || idx >= TAB_SIZE || cipher_descriptor[idx].name == NULL) {
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return CRYPT_INVALID_CIPHER;
}
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return CRYPT_OK;
}
示例11: ID
/**
Find a hash by ID number
@param ID The ID (not same as index) of the hash to find
@return >= 0 if found, -1 if not present
*/
int find_hash_id(unsigned char ID)
{
int x;
LTC_MUTEX_LOCK(<c_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x] && hash_descriptor[x]->ID == ID) {
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return -1;
}
示例12: ID
/**
Find a cipher by ID number
@param ID The ID (not same as index) of the cipher to find
@return >= 0 if found, -1 if not present
*/
INT find_cipher_id(UCHAR ID)
{
INT x;
LTC_MUTEX_LOCK(<c_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].ID == ID) {
x = (cipher_descriptor[x].name == NULL) ? -1 : x;
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return -1;
}
示例13: find_hash
/**
Find a registered hash by name
@param name The name of the hash to look for
@return >= 0 if found, -1 if not present
*/
int find_hash(const char *name)
{
int x;
LTC_ARGCHK(name != NULL);
LTC_MUTEX_LOCK(<c_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].name != NULL && XSTRCMP(hash_descriptor[x].name, name) == 0) {
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(<c_hash_mutex);
return -1;
}
示例14: find_cipher_id
int find_cipher_id(unsigned char ID)
{
int x;
LTC_MUTEX_LOCK(<c_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].ID == ID) {
x = (cipher_descriptor[x].name == NULL) ? -1 : x;
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(<c_cipher_mutex);
return -1;
}
示例15: find_prng
/**
Find a registered PRNG by name
@param name The name of the PRNG to look for
@return >= 0 if found, -1 if not present
*/
int find_prng(const char *name)
{
int x;
LTC_ARGCHK(name != NULL);
LTC_MUTEX_LOCK(<c_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if ((prng_descriptor[x].name != NULL) && strcmp(prng_descriptor[x].name, name) == 0) {
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(<c_prng_mutex);
return -1;
}