hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit ef41e579db9857fc6042057fe61946067cda3f8b
parent 78f23d2e8a2d00346d62a4a2425dad43180e7cab
Author: Sebastian <sebastian@sebsite.pw>
Date:   Fri,  8 Apr 2022 15:13:53 -0400

argon2: use alloc instead of rt::malloc

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mcrypto/argon2/argon2.ha | 9+--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/crypto/argon2/argon2.ha b/crypto/argon2/argon2.ha @@ -10,7 +10,6 @@ use endian; use errors::{nomem}; use hash; use io; -use rt; use types; // Latest version of argon2 supported by this implementation (1.3). @@ -174,14 +173,8 @@ fn argon2( assert(memsize >= 8 * cfg.parallel && memsize <= types::U32_MAX); - // TODO https://todo.sr.ht/~sircmpwn/hare/285 let membytes = memsize * BLOCKSIZE * 8; - let mem = match (rt::malloc(membytes): nullable *[*]u64) { - case null => - return nomem; - case let mem: *[*]u64 => - yield mem; - }; + let mem: []u64 = alloc([0...], membytes); yield mem[..membytes / 8]; }; // round down memory to nearest multiple of 4 times parallel