Import of old SSLeay release: SSLeay 0.8.1b
[openssl.git] / ssl / f
1 /* return the actual cipher being used */
2 char *SSL_CIPHER_get_name(c)
3 SSL_CIPHER *c;
4         {
5         if (c != NULL)
6                 return(c->name);
7         return("UNKNOWN");
8         }
9
10 /* number of bits for symetric cipher */
11 int SSL_CIPHER_get_bits(c,alg_bits)
12 SSL_CIPHER *c;
13 int *alg_bits;
14         {
15         int ret=0,a=0;
16         EVP_CIPHER *enc;
17
18         if (c != NULL)
19                 {
20                 if (!ssl_cipher_get_evp(c,&enc,NULL))
21                         return(0);
22
23                 a=EVP_CIPHER_key_length(enc)*8;
24
25                 if (s->session->cipher->algorithms & SSL_EXP)
26                         {
27                         if (c->algorithm2 & SSL2_CF_8_BYTE_ENC)
28                                 ret=64;
29                         else
30                                 ret=40;
31                         }
32                 else
33                         ret=a;
34                 }
35
36         if (alg_bits != NULL) *alg_bits=a;
37         
38         return(ret);
39         }
40