blob: 150250f42e42fb257990a22af6c887ecf9c57ebf (
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
|
/* ISC license. */
#include <string.h>
#include <bearssl.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
#include <skalibs/avltree.h>
#include <s6-networking/sbearssl.h>
#include "sbearssl-internal.h"
static void *sbearssl_sni_policy_node_dtok (uint32_t d, void *data)
{
return (void *)genalloc_s(sbearssl_sni_map, &((sbearssl_sni_policy_context *)data)->mapga)[d].servername ;
}
static int sbearssl_sni_policy_node_cmp (void const *a, void const *b, void *data)
{
(void)data ;
return strcmp((char const *)a, (char const *)b) ;
}
void sbearssl_sni_policy_init (sbearssl_sni_policy_context *pol)
{
avltree_init(&pol->map, 3, 3, 8, &sbearssl_sni_policy_node_dtok, &sbearssl_sni_policy_node_cmp, pol) ;
pol->mapga = genalloc_zero ;
pol->certga = genalloc_zero ;
pol->storage = stralloc_zero ;
pol->vtable = &sbearssl_sni_policy_vtable ;
}
|