Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GCC-14 [-Wincompatible-pointer-types] issue. #58

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bearssl/abi/bearssl_rand.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ proc hmacDrbgGetHash*(ctx: var HmacDrbgContext): ptr HashClass {.inline.} =

type
PrngSeeder* {.importc: "br_prng_seeder".} = proc (ctx: ptr ptr PrngClass): cint {.importcFunc.}
constCstringArray* {.importc: "const char**", nodecl.} = pointer


proc prngSeederSystem*(name: cstringArray): PrngSeeder {.importcFunc,
proc prngSeederSystem*(name: constCstringArray): PrngSeeder {.importcFunc,
importc: "br_prng_seeder_system", header: "bearssl_rand.h".}

# type
Expand Down
12 changes: 8 additions & 4 deletions bearssl/abi/bearssl_ssl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ type
alert* {.importc: "alert".}: byte
closeReceived* {.importc: "close_received".}: byte
mhash* {.importc: "mhash".}: MultihashContext
x509ctx* {.importc: "x509ctx".}: ptr ptr X509Class
x509ctx* {.importc: "x509ctx".}: X509ClassPointerConst
chain* {.importc: "chain".}: ptr X509Certificate
chainLen* {.importc: "chain_len".}: uint
certCur* {.importc: "cert_cur".}: ptr byte
Expand Down Expand Up @@ -612,9 +612,12 @@ proc sslEngineSetSuites*(cc: var SslEngineContext; suites: ptr uint16;
suitesNum: uint) {.importcFunc,
importc: "br_ssl_engine_set_suites", header: "bearssl_ssl.h".}

proc sslEngineSetX509*(cc: var SslEngineContext; x509ctx: ptr ptr X509Class) {.inline.} =
proc sslEngineSetX509*(cc: var SslEngineContext;
x509ctx: X509ClassPointerConst) =
cc.x509ctx = x509ctx

proc sslEngineSetX509*(cc: var SslEngineContext; x509ctx: ptr ptr X509Class) =
cc.x509ctx = X509ClassPointerConst(x509ctx)

proc sslEngineSetProtocolNames*(ctx: var SslEngineContext; names: cstringArray;
num: uint) {.inline.} =
Expand Down Expand Up @@ -1077,6 +1080,7 @@ type
params: ptr SslSessionParameters): cint {.importcFunc.}


SslSessionCacheClassPointerConst* {.importc: "const br_ssl_session_cache_class**", header: "bearssl_ssl.h", bycopy.} = pointer


SslSessionCacheLru* {.importc: "br_ssl_session_cache_lru",
Expand Down Expand Up @@ -1104,7 +1108,7 @@ type
bycopy.} = object
eng* {.importc: "eng".}: SslEngineContext
clientMaxVersion* {.importc: "client_max_version".}: uint16
cacheVtable* {.importc: "cache_vtable".}: ptr ptr SslSessionCacheClass
cacheVtable* {.importc: "cache_vtable".}: SslSessionCacheClassPointerConst
clientSuites* {.importc: "client_suites".}: array[MAX_CIPHER_SUITES,
SuiteTranslated]
clientSuitesNum* {.importc: "client_suites_num".}: byte
Expand Down Expand Up @@ -1222,7 +1226,7 @@ proc sslServerSetTrustAnchorNamesAlt*(cc: var SslServerContext;


proc sslServerSetCache*(cc: var SslServerContext;
vtable: ptr ptr SslSessionCacheClass) {.inline.} =
vtable: SslSessionCacheClassPointerConst) {.inline.} =
cc.cacheVtable = vtable


Expand Down
2 changes: 1 addition & 1 deletion bearssl/abi/bearssl_x509.nim
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ type
getPkey* {.importc: "get_pkey".}: proc (ctx: ptr ptr X509Class; usages: ptr cuint): ptr X509Pkey {.
importcFunc.}


X509ClassPointerConst* {.importc: "const br_x509_class**", header: "bearssl_x509.h", bycopy.} = pointer

type
X509KnownkeyContext* {.importc: "br_x509_knownkey_context",
Expand Down
2 changes: 1 addition & 1 deletion bearssl/rand.nim
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ proc new*(T: type HmacDrbgContext): ref HmacDrbgContext =
##
## The context is seeded with randomness from the OS / system.
## Returns `nil` if the OS / system has no randomness API.
let seeder = prngSeederSystem(nil)
let seeder = prngSeederSystem(constCstringArray(nil))
if seeder == nil:
return nil

Expand Down
Loading