#ifndef __CKCAPI_UTIL_H__ #define __CKCAPI_UTIL_H__ #include /* -------------------------------------------------------------------------------- * WINDOWS */ CK_RV ckcapi_util_win_to_cryptoki_err (DWORD werr); /* -------------------------------------------------------------------------------- * ARRAYS */ typedef struct _Array { void* data; size_t len; } Array; #define ckcapi_util_array_append(a,v) \ ckcapi_util_array_append_vals(a, &(v), 1) #define ckcapi_util_array_index(a,t,i) \ (((t*) (a)->data) [(i)]) Array* ckcapi_util_array_new (int zero_terminated, int zero, size_t element_size); Array* ckcapi_util_array_sized_new (int zero_terminated, int zero, size_t element_size, size_t reserved_size); void* ckcapi_util_array_free (Array* array, int free_segment); int ckcapi_util_array_append_vals (Array* array, const void* data, size_t num); void ckcapi_util_array_remove_index (Array* array, unsigned int index); void ckcapi_util_array_remove_range (Array* array, unsigned int index, size_t count); #endif /* __CKCAPI_UTIL_H__ */