Ignore:
Timestamp:
05/01/11 00:12:34 (9 years ago)
Author:
Admin
Message:

WebIf: Add thread locks to SSL mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oscam-http-helpers.c

    r5134 r5139  
    724724}
    725725
     726#ifdef WITH_SSL
     727/* Locking functions for SSL multithreading */
     728static pthread_mutex_t *lock_cs;
     729struct CRYPTO_dynlock_value{
     730    pthread_mutex_t mutex;
     731};
     732
     733uintptr_t SSL_id_function(void){
     734    return ((uintptr_t) pthread_self());
     735}
     736
     737void SSL_locking_function(int32_t mode, int32_t type, const char *file, int32_t line){
     738    if (mode & CRYPTO_LOCK) {
     739        pthread_mutex_lock(&lock_cs[type]);
     740    } else {
     741        pthread_mutex_unlock(&lock_cs[type]);
     742    }
     743    // just to remove compiler warnings...
     744    if(file || line) return;
     745}
     746
     747struct CRYPTO_dynlock_value *SSL_dyn_create_function(const char *file, int line){
     748    struct CRYPTO_dynlock_value *value;
     749    if(!cs_malloc(&value, sizeof(struct CRYPTO_dynlock_value), -1)) return (NULL);
     750    pthread_mutex_init(&value->mutex, NULL);
     751    // just to remove compiler warnings...
     752        if(file || line) return value;
     753    return value;
     754}
     755
     756void SSL_dyn_lock_function(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line){
     757    if (mode & CRYPTO_LOCK) {
     758        pthread_mutex_lock(&l->mutex);
     759    } else {
     760        pthread_mutex_unlock(&l->mutex);
     761    }
     762    // just to remove compiler warnings...
     763    if(file || line) return;
     764}
     765
     766void SSL_dyn_destroy_function(struct CRYPTO_dynlock_value *l, const char *file, int line){
     767    pthread_mutex_destroy(&l->mutex);
     768    free(l);
     769    // just to remove compiler warnings...
     770    if(file || line) return;
     771}
    726772#endif
     773#endif
Note: See TracChangeset for help on using the changeset viewer.