diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-02-14 17:05:42 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-02-14 17:05:42 +0000 |
commit | c876a4b7b119faa80add62d7a04b46eda8b7bf99 (patch) | |
tree | cf6da21dc438ac37042f43b94202a62064632807 /fips/utl | |
parent | c966120412eed91db87f83b863ccd1ea68bb9468 (diff) |
Include support for an add_lock callback to tiny FIPS locking API.
Diffstat (limited to 'fips/utl')
-rw-r--r-- | fips/utl/fips_lck.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/fips/utl/fips_lck.c b/fips/utl/fips_lck.c index 32a44431c2..7cb10bc0d2 100644 --- a/fips/utl/fips_lck.c +++ b/fips/utl/fips_lck.c @@ -59,6 +59,8 @@ /* FIPS locking callbacks */ static void (*fips_lck_cb)(int mode, int type,const char *file,int line) = 0; +static int (*fips_add_cb)(int *pointer, int amount, int type, const char *file, + int line); void FIPS_lock(int mode, int type,const char *file,int line) { @@ -66,8 +68,20 @@ void FIPS_lock(int mode, int type,const char *file,int line) fips_lck_cb(mode, type, file, line); } -void FIPS_set_locking_callback (void (*func)(int mode, int type, - const char *file,int line)) +void FIPS_set_locking_callbacks(void (*func)(int mode, int type, + const char *file,int line), + int (*add_cb)(int *pointer, int amount, + int type, const char *file, int line)) { fips_lck_cb = func; + fips_add_cb = add_cb; + } + +int FIPS_add_lock(int *pointer, int amount, int type, const char *file, + int line) + { + if (fips_add_cb) + return fips_add_cb(pointer, amount, type, file, line); + *pointer += amount; + return *pointer; } |