Hash :
67d1e7a9
Author :
Thomas de Grivel
Date :
2025-09-08T12:13:54
wip tls test
MyType* buf_inspect_pointer buf_inspect_pointer_size hash_update_pointer pointer_init_copy marshall_read_pointer marshall_pointer g_sym_Pointer sym_is_pointer_type compare_pointer sym_to_tag_type sym_is_pointer_type() → TAG_POINTER sym_must_clean sym_is_pointer_type() → false data_* data_buf_inspect data_buf_inspect_size data_clean data_compare data_hash_update data_init_cast data_init_copy pointer_init_cast https://github.com/bob-beck/libtls/blob/master/TUTORIAL.md
tls_buf.c/h s_tls_buf tls_buf_open_r opens a tls connection for reading buf->refill callback to refill the tls_open_r buffer tls_buf_open_w opens a tls connection for writing buf->flush callback to flush the tls_open_w buffer sw buf_fd_open_w_flush (s_buf *buf) tls_buf_close puts("ikc3: connected with TLS v1.2 to ${g_host} ${g_port}") #include <tls.h> tls_init() != 0 struct tls_config *config = tls_config_new(); tls_configure(ctx, config); tls_write(ctx, data, size) tls_read(ctx, data, size); tls_close(ctx); tls_free tls_config_free (isn’t that tls_config_delete, what’s the difference ?) tls_config_set_ca_file(config, "/etc/ssl/cert.pem"); struct tls *ctx = tls_client(); tls_connect_socket(ctx, socket_fd, "hostname"); libtls_server_example.c tls_config_set_cert_file set server certificate tls_config_set_key_file set server certificate private key ctx = tls_server() tls_accept_socket marshall_read | Type | Write | Read | Needs |
|---|
| Signed/unsigned | [x] | [x] |
| Character | [x] | [x] |
| Str | [x] | [x] |
| Pointer | [x] | [x] |
| Tag | [x] | [x] | Everything else | | Tuple | [x] | [x] | | Float | [x] | [x] | | Ident | [x] | [x] | | Call | [x] | [x] | pcallable | | Do Block | [x] | [x] | call | | Map | [x] | [x] | Tag | | Sym | [x] | [x] | str | Callable | [x] | [x] | u_callable_data | | PCallable | [x] | [x] | callable | | cfn | [x] | [x] | | fn | [x] | [x] | | Ratio | [x] | [x] | | Quote | [x] | [x] | | Var | [x] | [x] | Tag | | PVar | [x] | [x] | | Complex | [x] | [x] | | Unquote | [x] | [x] | Tag | | Time | [x] | [x] | Tag | | Ptr | [x] | [x] | | Ptr free | [x] | [x] | | Array | [x] | [x] | | Fact | [x] | [x] | | Struct | [x] | [x] | | StructType | [x] | [x] | | PStruct | [x] | [x] | | PStructType | [x] | [x] | | PTag | [x] | [x] | Tag | | Facts | [x] | [x] | | Env | [x] | [x] | Facts |
[x] : Done [ ] : Not implemented [.] : Work in progress [?] : Has to be tested/verified
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
# TODO
## libkc3
- [?] Generic typed pointers : `MyType*`
- [x] `buf_inspect_pointer`
- [x] `buf_inspect_pointer_size`
- [x] `hash_update_pointer`
- [x] `pointer_init_copy`
- [x] `marshall_read_pointer`
- [x] `marshall_pointer`
- [x] `g_sym_Pointer`
- [x] `sym_is_pointer_type`
- [x] `compare_pointer`
- [x] `sym_to_tag_type`
- `sym_is_pointer_type() → TAG_POINTER`
- [x] `sym_must_clean`
- `sym_is_pointer_type() → false`
- [x] `data_*`
- [x] `data_buf_inspect`
- [x] `data_buf_inspect_size`
- [x] `data_clean`
- [x] `data_compare`
- [x] `data_hash_update`
- [x] `data_init_cast`
- [x] `data_init_copy`
- [x] `pointer_init_cast`
## LibreSSL/OpenSSL
<https://github.com/bob-beck/libtls/blob/master/TUTORIAL.md>
- [x] new library
- [x] explore SSL API for stream socket connections with a certificate.
- implement
- [x] `tls_buf.c/h`
- [x] struct `s_tls_buf`
- `tls_buf_open_r` opens a tls connection for reading
- [.] `buf->refill` callback to refill the `tls_open_r` buffer
- `tls_buf_open_w` opens a tls connection for writing
- [.] `buf->flush` callback to flush the `tls_open_w` buffer
- `sw buf_fd_open_w_flush (s_buf *buf)`
- [ ] `tls_buf_close`
- ikc3 **--tls** --client/server
- `puts("ikc3: connected with TLS v1.2 to ${g_host} ${g_port}")`
- [ ] wrap the following functions in lib/kc3/0.1 :
- [ ] Common TLS API :
- [x] `#include <tls.h>`
- [lyzer] `tls_init() != 0`
- [lyzer] `struct tls_config *config = tls_config_new();`
- [lyzer] `tls_configure(ctx, config);`
- [perle] `tls_write(ctx, data, size)`
- [perle] `tls_read(ctx, data, size);`
- [perle] `tls_close(ctx);`
- [x] `tls_free`
- [x] `tls_config_free` (isn't that tls_config_delete, what's the difference ?)
- [ ] Basic TLS Client :
- [x] `tls_config_set_ca_file(config, "/etc/ssl/cert.pem");`
- [x] `struct tls *ctx = tls_client();`
- [x] `tls_connect_socket(ctx, socket_fd, "hostname");`
- [ ] Basic TLS Server, see `libtls_server_example.c`
- [?] `tls_config_set_cert_file` set server certificate
- [ ] `tls_config_set_key_file` set server certificate private key
- [?] `ctx = tls_server()`
- [?] `tls_accept_socket`
- [ ] ikc3 tests
- [ ] copier test/ikc3_test test/tls_test
- [ ] ecrire des tests fonctionnels dans test/tls/
## libkc3
- [ ] unveil
- [ ] pledge
## HTTPd
- [ ] partial requests
- HTTP 206 partial content
- [ ] SSL
- ajouter le support de tls dans lib/kc3/0.1/httpd.kc3
- [ ] Securelevel = 2
- [ ] definir toutes les fonctions locales dans leur module avec def
## Marshall
- [x] env_dump/restore
- [x] test_httpd
- [x] www
- [x] StructType
- [x] we should not record offsets in struct type but rather just
the map and recalculate offsets and size at `marshall_read`
- [x] must_clean
| Type | Write | Read | Needs |
| --------------- | ------ | ------ | --------------- |
| Signed/unsigned | [x] | [x] |
| Character | [x] | [x] |
| Str | [x] | [x] |
| Pointer | [x] | [x] |
| Tag | [x] | [x] | Everything else |
| Tuple | [x] | [x] |
| Float | [x] | [x] |
| Ident | [x] | [x] |
| Call | [x] | [x] | pcallable |
| Do Block | [x] | [x] | call |
| Map | [x] | [x] | Tag |
| Sym | [x] | [x] | str
| Callable | [x] | [x] | u_callable_data |
| PCallable | [x] | [x] | callable |
| cfn | [x] | [x] |
| fn | [x] | [x] |
| Ratio | [x] | [x] |
| Quote | [x] | [x] |
| Var | [x] | [x] | Tag |
| PVar | [x] | [x] |
| Complex | [x] | [x] |
| Unquote | [x] | [x] | Tag |
| Time | [x] | [x] | Tag |
| Ptr | [x] | [x] |
| Ptr free | [x] | [x] |
| Array | [x] | [x] |
| Fact | [x] | [x] |
| Struct | [x] | [x] |
| StructType | [x] | [x] |
| PStruct | [x] | [x] |
| PStructType | [x] | [x] |
| PTag | [x] | [x] | Tag |
| Facts | [x] | [x] |
| Env | [x] | [x] | Facts |
[x] : Done
[ ] : Not implemented
[.] : Work in progress
[?] : Has to be tested/verified