Changes between 0.9.8g and 0.9.9 [xx XXX xxxx]
- *) To support arbitrarily-typed thread IDs, deprecate the existing
+ *) Not all of this is true any longer.
+ Will have to be updated to reflect all subsequent changes to cryptlib.c.
+ --bodo
+
+
+ To support arbitrarily-typed thread IDs, deprecate the existing
type-specific APIs for a general purpose CRYPTO_THREADID
interface. Applications can choose the thread ID
callback type it wishes to register, as before;
void CRYPTO_THREADID_set(CRYPTO_THREADID *id)
{
- memset(id, 0, sizeof(*id));
+ if (id_callback)
+ id->ulong = id_callback();
+ else
+ id->ulong = 0;
+
if (idptr_callback)
id->ptr = idptr_callback();
- else if (id_callback)
- id->ulong = id_callback();
else
id->ptr = &errno;
}
int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *id1, const CRYPTO_THREADID *id2)
{
+ if (id1->ulong != id2->ulong)
+ return ((id1->ulong < id2->ulong) ? -1 : 1);
if (id1->ptr != id2->ptr)
return ((id1->ptr < id2->ptr) ? -1 : 1);
- if (id1->ulong != id2->ulong)
- return ((id1->ulong < id2->ulong ) ? -1 : 1);
return 0;
}
unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id)
{
- if (idptr_callback || !id_callback)
- return (unsigned long)id->ptr;
- return id->ulong;
+ /* will need further processing to arrive at a good hash (mem_dbg.c uses this) */
+ return id->ulong + (unsigned long)id->ptr;
}
void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dst, const CRYPTO_THREADID *src)
* apart when someone decides to extend this in some way. */
typedef struct crypto_threadid
{
- void *ptr;
unsigned long ulong;
+ void *ptr;
} CRYPTO_THREADID;
/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA