Fix gcc-14 issues part 2. (#61)

* Fix recently discovered nim-2.0 gcc-14 issues.

* One more place to fix.
This commit is contained in:
Eugene Kabanov 2024-06-27 01:42:04 +03:00 committed by GitHub
parent 8790ee6401
commit 554b464b34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 4 deletions

View File

@ -325,10 +325,14 @@ const
EC_KBUF_PUB_MAX_SIZE* = 145
proc ecKeygen*(rngCtx: ptr ptr PrngClass; impl: ptr EcImpl; sk: ptr EcPrivateKey;
proc ecKeygen*(rngCtx: PrngClassPointerConst; impl: ptr EcImpl; sk: ptr EcPrivateKey;
kbuf: pointer; curve: cint): uint {.importcFunc, importc: "br_ec_keygen",
header: "bearssl_ec.h".}
proc ecKeygen*(rngCtx: ptr ptr PrngClass; impl: ptr EcImpl; sk: ptr EcPrivateKey;
kbuf: pointer; curve: cint): uint =
ecKeygen(PrngClassPointerConst(rngCtx), impl, sk, kbuf, curve)
proc ecComputePub*(impl: ptr EcImpl; pk: ptr EcPublicKey; kbuf: pointer;
sk: ptr EcPrivateKey): uint {.importcFunc,
importc: "br_ec_compute_pub", header: "bearssl_ec.h".}

View File

@ -21,6 +21,7 @@ type
update* {.importc: "update".}: proc (ctx: ptr ptr PrngClass; seed: pointer;
seedLen: uint) {.importcFunc.}
PrngClassPointerConst* {.importc: "const br_prng_class**", header: "bearssl_rand.h", bycopy.} = pointer
type
@ -51,7 +52,7 @@ proc hmacDrbgGetHash*(ctx: var HmacDrbgContext): ptr HashClass {.inline.} =
type
PrngSeeder* {.importc: "br_prng_seeder".} = proc (ctx: ptr ptr PrngClass): cint {.importcFunc.}
PrngSeeder* {.importc: "br_prng_seeder".} = proc (ctx: PrngClassPointerConst): cint {.importcFunc.}
constCstringArray* {.importc: "const char**", nodecl.} = pointer
proc prngSeederSystem*(name: constCstringArray): PrngSeeder {.importcFunc,

View File

@ -18,8 +18,11 @@ type
vtable* {.importc: "vtable".}: ptr X509Class
inner* {.importc: "inner".}: ptr ptr X509Class
proc x509NoanchorInit*(xwc: var X509NoanchorContext; inner: ptr ptr X509Class) {.importcFunc,
proc x509NoanchorInit*(xwc: var X509NoanchorContext; inner: X509ClassPointerConst) {.importcFunc,
importc: "x509_noanchor_init", header: "brssl_cpp.h".}
proc x509NoanchorInit*(xwc: var X509NoanchorContext; inner: ptr ptr X509Class) =
x509NoanchorInit(xwc, X509ClassPointerConst(inner))
proc initNoAnchor*(xwc: var X509NoanchorContext, inner: ptr ptr X509Class) {.
importcFunc, importc: "x509_noanchor_init", header: "brssl_cpp.h", deprecated: "x509NoanchorInit".}

View File

@ -39,7 +39,7 @@ proc new*(T: type HmacDrbgContext): ref HmacDrbgContext =
let rng = (ref HmacDrbgContext)()
hmacDrbgInit(rng[], addr sha256Vtable, nil, 0)
if seeder(addr rng.vtable) == 0:
if seeder(PrngClassPointerConst(addr rng.vtable)) == 0:
return nil
rng