quicp2p/picotls/openssl.nim

37 lines
1.1 KiB
Nim

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
ptls_openssl_signature_scheme_t* {.bycopy.} = object
scheme_id*: uint16
scheme_md*: PEVP_MD
ptls_openssl_sign_certificate_t* {.bycopy.} = object
super*: ptls_sign_certificate_t
key*: EVP_PKEY
schemes*: array[4, ptls_openssl_signature_scheme_t]
ptls_openssl_verify_certificate_t* {.bycopy.} = object
super*: ptls_verify_certificate_t
cert_store*: PX509_STORE
proc ptls_openssl_random_bytes*(buf: pointer, len: csize_t) {.cdecl, importc.}
proc ptls_openssl_init_verifiy_certificate*(self: ptr ptls_openssl_verify_certificate_t,
store: PX509_STORE): cint {.cdecl, importc.}
proc ptls_openssl_init_sign_certificate*(self: ptr ptls_openssl_sign_certificate_t,
key: EVP_PKEY): cint {.cdecl, importc.}
var ptls_openssl_cipher_suites* {.importc.}: ptr ptr ptls_cipher_suite_t
var ptls_openssl_key_exchanges* {.importc.}: ptr ptr ptls_key_exchange_algorithm_t