]> pd.if.org Git - zpackage/blob - crypto/cipher_name.c
ocb mode fixup
[zpackage] / crypto / cipher_name.c
1 #define _POSIX_C_SOURCE 200809L
2
3 #include "tlse.h"
4
5 const char *tls_cipher_name(struct TLSContext *context) {
6         if (!context) {
7                 return "UNKNOWN";
8         }
9
10         switch (context->cipher) {
11                 case TLS_RSA_WITH_AES_128_CBC_SHA:
12                         return "RSA-AES128CBC-SHA";
13                 case TLS_RSA_WITH_AES_256_CBC_SHA:
14                         return "RSA-AES256CBC-SHA";
15                 case TLS_RSA_WITH_AES_128_CBC_SHA256:
16                         return "RSA-AES128CBC-SHA256";
17                 case TLS_RSA_WITH_AES_256_CBC_SHA256:
18                         return "RSA-AES256CBC-SHA256";
19                 case TLS_RSA_WITH_AES_128_GCM_SHA256:
20                         return "RSA-AES128GCM-SHA256";
21                 case TLS_RSA_WITH_AES_256_GCM_SHA384:
22                         return "RSA-AES256GCM-SHA384";
23                 case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:
24                         return "DHE-RSA-AES128CBC-SHA";
25                 case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:
26                         return "DHE-RSA-AES256CBC-SHA";
27                 case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:
28                         return "DHE-RSA-AES128CBC-SHA256";
29                 case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:
30                         return "DHE-RSA-AES256CBC-SHA256";
31                 case TLS_DHE_RSA_WITH_AES_128_GCM_SHA256:
32                         return "DHE-RSA-AES128GCM-SHA256";
33                 case TLS_DHE_RSA_WITH_AES_256_GCM_SHA384:
34                         return "DHE-RSA-AES256GCM-SHA384";
35                 case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
36                         return "ECDHE-RSA-AES128CBC-SHA";
37                 case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
38                         return "ECDHE-RSA-AES256CBC-SHA";
39                 case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:
40                         return "ECDHE-RSA-AES128CBC-SHA256";
41                 case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:
42                         return "ECDHE-RSA-AES128GCM-SHA256";
43                 case TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:
44                         return "ECDHE-RSA-AES256GCM-SHA384";
45                 case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
46                         return "ECDHE-ECDSA-AES128CBC-SHA";
47                 case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
48                         return "ECDHE-ECDSA-AES256CBC-SHA";
49                 case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
50                         return "ECDHE-ECDSA-AES128CBC-SHA256";
51                 case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
52                         return "ECDHE-ECDSA-AES256CBC-SHA384";
53                 case TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
54                         return "ECDHE-ECDSA-AES128GCM-SHA256";
55                 case TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
56                         return "ECDHE-ECDSA-AES256GCM-SHA384";
57                 case TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:
58                         return "ECDHE-RSA-CHACHA20-POLY1305-SHA256";
59                 case TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:
60                         return "ECDHE-ECDSA-CHACHA20-POLY1305-SHA256";
61                 case TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256:
62                         return "ECDHE-DHE-CHACHA20-POLY1305-SHA256";
63                 case TLS_AES_128_GCM_SHA256:
64                         return "TLS-AES-128-GCM-SHA256";
65                 case TLS_AES_256_GCM_SHA384:
66                         return "TLS-AES-256-GCM-SHA384";
67                 case TLS_CHACHA20_POLY1305_SHA256:
68                         return "TLS-CHACHA20-POLY1305-SHA256";
69                 case TLS_AES_128_CCM_SHA256:
70                         return "TLS-AES-128-CCM-SHA256";
71                 case TLS_AES_128_CCM_8_SHA256:
72                         return "TLS-AES-128-CCM-8-SHA256";
73         }
74         return "UNKNOWN";
75 }