summaryrefslogtreecommitdiff
path: root/src/sbearssl/sbearssl-internal.h
blob: d8e0c576eaf538886a930d568318088a6a13ed55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* ISC license. */

#ifndef SBEARSSL_INTERNAL_H
#define SBEARSSL_INTERNAL_H

#include <sys/types.h>
#include <stdint.h>

#include <bearssl.h>

#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>

#include <s6-networking/sbearssl.h>

typedef struct sbearssl_strallocerr_s sbearssl_strallocerr, *sbearssl_strallocerr_ref ;
struct sbearssl_strallocerr_s
{
  stralloc *sa ;
  int err ;
} ;

typedef enum sbearssl_suite_prop_e sbearssl_suite_prop ;
enum sbearssl_suite_prop_e
{
 /* key exchange */
  kRSA      = 1<<0,
  ECDHE     = 1<<1,

 /* authentication */
  aRSA      = 1<<2,
  ECDSA     = 1<<3,

 /* encryption */
  TRIPLEDES = 1<<4,
  AES128    = 1<<5,
  AES256    = 1<<6,
  AESGCM    = 1<<7,
  AESCCM    = 1<<8,
  AESCCM8   = 1<<9,
  CHACHA20  = 1<<10,

 /* MAC */
  AEAD      = 1<<11,
  SHA1      = 1<<12,
  SHA256    = 1<<13,
  SHA384    = 1<<14,

 /* minimum TLS version */
  TLS10     = 1<<15,
  TLS12     = 1<<16,

 /* strength */
  HIGH      = 1<<17,
  MEDIUM    = 1<<18,
  LOW       = 1<<19,
} ;

typedef struct sbearssl_suiteinfo_s sbearssl_suiteinfo, *sbearssl_suiteinfo_ref ;
struct sbearssl_suiteinfo_s
{
  char name[32] ;
  uint16_t id ;
  sbearssl_suite_prop prop ;
  uint16_t bits ;
} ;

extern size_t sbearssl_get_tas (genalloc *, stralloc *) ;
extern size_t sbearssl_get_keycert (sbearssl_skey *, genalloc *, stralloc *) ;

extern void sbearssl_drop (void) ;
extern void sbearssl_append (void *, void const *, size_t) ;
extern int sbearssl_pem_push (br_pem_decoder_context *, char const *, size_t, sbearssl_pemobject *, genalloc *, sbearssl_strallocerr *, int *) ;

extern sbearssl_suiteinfo const *const sbearssl_suite_list ;
extern size_t const sbearssl_suite_list_len ;

typedef struct sbearssl_sni_policy_node_s sbearssl_sni_policy_node, *sbearssl_policy_node_ref ;
struct sbearssl_sni_policy_node_s
{
  size_t servername ;
  sbearssl_skey skey ;
  size_t chainindex ;
  size_t chainlen ;
} ;

#endif