Add functionality to get information on compression methods (not quite complete).
authorRichard Levitte <levitte@openssl.org>
Mon, 6 Oct 2003 12:18:39 +0000 (12:18 +0000)
committerRichard Levitte <levitte@openssl.org>
Mon, 6 Oct 2003 12:18:39 +0000 (12:18 +0000)
ssl/ssl.h
ssl/ssl_algs.c
ssl/ssl_ciph.c
ssl/ssl_lib.c

index 2d4035090f1bfc27628e1b5ecf08a7c164c4964d..e6879d9073255693ae4b8cf6334b2a88905bda54 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -1198,6 +1198,10 @@ int      SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits);
 char * SSL_CIPHER_get_version(SSL_CIPHER *c);
 const char *   SSL_CIPHER_get_name(SSL_CIPHER *c);
 
+const COMP_METHOD *SSL_get_current_compression(SSL *s);
+const COMP_METHOD *SSL_get_current_expansion(SSL *s);
+const char *SSL_COMP_get_name(const COMP_METHOD *comp);
+
 int    SSL_get_fd(SSL *s);
 int    SSL_get_rfd(SSL *s);
 int    SSL_get_wfd(SSL *s);
index 7c8a451fc56c8d0c4e9d83563e82449121583316..1a41b9967cf4548580797ebc7663328a4a01d40f 100644 (file)
@@ -108,6 +108,12 @@ int SSL_library_init(void)
 #if 0
        EVP_add_digest(EVP_sha());
        EVP_add_digest(EVP_dss());
+#endif
+#ifndef OPENSSL_NO_COMP
+       /* This will initialise the built-in compression algorithms.
+          The value returned is a STACK_OF(SSL_COMP), but that can
+          be discarded safely */
+       (void)SSL_COMP_get_compression_methods();
 #endif
        return(1);
        }
index 44b50feff77778b997e4b9695d906f03e1793066..4f0f700790e2bdb39cb9794415f66e9aa4b03f96 100644 (file)
@@ -1204,3 +1204,11 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
                return(0);
                }
        }
+
+const char *SSL_COMP_get_name(const COMP_METHOD *comp)
+       {
+       if (comp)
+               return comp->name;
+       return NULL;
+       }
+
index 0c84e3dddddea4a139096d37e36527bdee467877..bf7d7ba561100d1ed9bbb8d83d9a674401206457 100644 (file)
@@ -2207,6 +2207,20 @@ SSL_CIPHER *SSL_get_current_cipher(SSL *s)
        return(NULL);
        }
 
+const COMP_METHOD *SSL_get_current_compression(SSL *s)
+       {
+       if (s->compress != NULL)
+               return(s->compress->meth);
+       return(NULL);
+       }
+
+const COMP_METHOD *SSL_get_current_expansion(SSL *s)
+       {
+       if (s->expand != NULL)
+               return(s->expand->meth);
+       return(NULL);
+       }
+
 int ssl_init_wbio_buffer(SSL *s,int push)
        {
        BIO *bbio;