Changeset 78b8401 for lib


Ignore:
Timestamp:
2011-12-19T17:22:37Z (8 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
af5764e
Parents:
486ddb5
Message:

Move conversion of status codes to status messages into SSL libs.

Location:
lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_bogus.c

    r486ddb5 r78b8401  
    7070        return 0;
    7171}
     72
     73char *ssl_verify_strerror( int code )
     74{
     75        return NULL;
     76}
  • lib/ssl_client.h

    r486ddb5 r78b8401  
    101101G_MODULE_EXPORT b_input_condition ssl_getdirection( void *conn );
    102102
     103/* Converts a verification bitfield passed to ssl_input_function into
     104   a more useful string. Or NULL if it had no useful bits set. */
     105G_MODULE_EXPORT char *ssl_verify_strerror( int code );
     106
    103107G_MODULE_EXPORT size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, const unsigned char *input, size_t input_len, const unsigned char *iv, unsigned char **res);
  • lib/ssl_gnutls.c

    r486ddb5 r78b8401  
    193193
    194194        return verifyret;
     195}
     196
     197char *ssl_verify_strerror( int code )
     198{
     199        GString *ret = g_string_new( "" );
     200       
     201        if( code & VERIFY_CERT_REVOKED )
     202                g_string_append( ret, "certificate has been revoked, " );
     203        if( code & VERIFY_CERT_SIGNER_NOT_FOUND )
     204                g_string_append( ret, "certificate hasn't got a known issuer, " );
     205        if( code & VERIFY_CERT_SIGNER_NOT_CA )
     206                g_string_append( ret, "certificate's issuer is not a CA, " );
     207        if( code & VERIFY_CERT_INSECURE_ALGORITHM )
     208                g_string_append( ret, "certificate uses an insecure algorithm, " );
     209        if( code & VERIFY_CERT_NOT_ACTIVATED )
     210                g_string_append( ret, "certificate has not been activated, " );
     211        if( code & VERIFY_CERT_EXPIRED )
     212                g_string_append( ret, "certificate has expired, " );
     213        if( code & VERIFY_CERT_WRONG_HOSTNAME )
     214                g_string_append( ret, "certificate hostname mismatch, " );
     215       
     216        if( ret->len == 0 )
     217        {
     218                g_string_free( ret, TRUE );
     219                return NULL;
     220        }
     221        else
     222        {
     223                g_string_truncate( ret, ret->len - 2 );
     224                return g_string_free( ret, FALSE );
     225        }
    195226}
    196227
  • lib/ssl_nss.c

    r486ddb5 r78b8401  
    252252        return B_EV_IO_READ;
    253253}
     254
     255char *ssl_verify_strerror( int code )
     256{
     257        return g_strdup( "SSL certificate verification not supported by BitlBee NSS code." );
     258}
  • lib/ssl_openssl.c

    r486ddb5 r78b8401  
    288288}
    289289
     290char *ssl_verify_strerror( int code )
     291{
     292        return g_strdup( "SSL certificate verification not supported by BitlBee OpenSSL code." );
     293}
     294
    290295size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, const unsigned char *input, size_t input_len, const unsigned char *iv, unsigned char **res)
    291296{
Note: See TracChangeset for help on using the changeset viewer.