2020-11-02 00:52:13 +01:00
|
|
|
from std/openssl import
|
|
|
|
EVP_PKEY,
|
|
|
|
PEVP_MD,
|
|
|
|
PX509_STORE
|
|
|
|
|
|
|
|
from picotls import
|
|
|
|
ptls_cipher_suite_t,
|
|
|
|
ptls_key_exchange_algorithm_t,
|
|
|
|
ptls_sign_certificate_t,
|
|
|
|
ptls_verify_certificate_t
|
|
|
|
|
|
|
|
type
|
2020-11-07 11:42:11 +01:00
|
|
|
ptls_openssl_signature_scheme_t* {.importc: "struct st_ptls_openssl_signature_scheme_t", header: "picotls/openssl.h", bycopy.} = object
|
2020-11-02 00:52:13 +01:00
|
|
|
scheme_id*: uint16
|
|
|
|
scheme_md*: PEVP_MD
|
|
|
|
|
2020-11-07 11:42:11 +01:00
|
|
|
ptls_openssl_sign_certificate_t* {.importc, header: "picotls/openssl.h", bycopy.} = object
|
2020-11-02 00:52:13 +01:00
|
|
|
super*: ptls_sign_certificate_t
|
|
|
|
key*: EVP_PKEY
|
|
|
|
schemes*: array[4, ptls_openssl_signature_scheme_t]
|
|
|
|
|
2020-11-07 11:42:11 +01:00
|
|
|
ptls_openssl_verify_certificate_t* {.importc, header: "picotls/openssl.h", bycopy.} = object
|
2020-11-02 00:52:13 +01:00
|
|
|
super*: ptls_verify_certificate_t
|
|
|
|
cert_store*: PX509_STORE
|
|
|
|
|
2020-11-07 11:42:11 +01:00
|
|
|
proc ptls_openssl_random_bytes*(buf: pointer, len: csize_t) {.importc, header: "picotls/openssl.h", cdecl.}
|
2020-11-02 00:52:13 +01:00
|
|
|
|
|
|
|
proc ptls_openssl_init_verifiy_certificate*(self: ptr ptls_openssl_verify_certificate_t,
|
2020-11-07 11:42:11 +01:00
|
|
|
store: PX509_STORE): cint {.importc, header: "picotls/openssl.h", cdecl.}
|
2020-11-02 00:52:13 +01:00
|
|
|
|
|
|
|
proc ptls_openssl_init_sign_certificate*(self: ptr ptls_openssl_sign_certificate_t,
|
2020-11-07 11:42:11 +01:00
|
|
|
key: EVP_PKEY): cint {.importc, header: "picotls/openssl.h", cdecl.}
|
2020-11-02 00:52:13 +01:00
|
|
|
|
2020-11-07 11:42:11 +01:00
|
|
|
var ptls_openssl_cipher_suites* {.importc, header: "picotls/openssl.h".}: ptr ptr ptls_cipher_suite_t
|
2020-11-02 00:52:13 +01:00
|
|
|
|
2020-11-07 11:42:11 +01:00
|
|
|
var ptls_openssl_key_exchanges* {.importc, header: "picotls/openssl.h".}: ptr ptr ptls_key_exchange_algorithm_t
|