Refactored the crypto submodules to comply with the engine resolution method
This commit is contained in:
parent
c292832280
commit
891727d959
9 changed files with 132 additions and 133 deletions
|
|
@ -50,7 +50,7 @@ pub fn resolveEngine(comptime provider: PartialEngine) Engine {
|
|||
|
||||
return .{
|
||||
.aes_cbc256 = provider.aes_cbc256 orelse AES.CBC256_DefaultImplementation,
|
||||
.ed25519 = provider.ed25519 orelse ED25519.DefaultImplementation(randomImpl),
|
||||
.ed25519 = provider.ed25519 orelse ED25519.defaultImplementation(randomImpl),
|
||||
.hkdf = provider.hkdf orelse HKDF.DefaultImplementation,
|
||||
.hmac = provider.hmac orelse HMAC.DefaultImplementation,
|
||||
.sha256 = provider.sha256 orelse SHA256.DefaultImplementation,
|
||||
|
|
@ -69,9 +69,9 @@ const std = @import("std");
|
|||
test "AES encryption defaults" {
|
||||
|
||||
const crypto = resolveEngine(.{});
|
||||
|
||||
var data = [_]u8{ 1, 2, 3, 4 };
|
||||
const key = [_]u8{ 1, 2, 3, 4 };
|
||||
const iv = [_]u8{ 1, 2, 3, 4 };
|
||||
crypto.aes_cbc256.encrypt(&data, &key, &iv);
|
||||
|
||||
var data: []u8 = undefined;
|
||||
const key: [32]u8 = undefined;
|
||||
const iv: [16]u8 = undefined;
|
||||
crypto.aes_cbc256.encrypt(&key, &iv, &data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue