Browse Source

core/crypto/gost: Remove, exotic

Yawning Angel 1 year ago
parent
commit
8438d66e6b

+ 0 - 1
core/crypto/README.md

@@ -10,7 +10,6 @@ Please see the chart below for the options.
 |:-------------------------------------------------------------------------------------------------------------|:-----------------|
 | [BLAKE2B](https://datatracker.ietf.org/doc/html/rfc7693)                                                     | ✔️ |
 | [BLAKE2S](https://datatracker.ietf.org/doc/html/rfc7693)                                                     | ✔️ |
-| [GOST](https://datatracker.ietf.org/doc/html/rfc5831)                                                        | ✔️ |
 | [Grøstl](http://www.groestl.info/Groestl.zip)                                                                | ✔️ |
 | [HAVAL](https://web.archive.org/web/20150111210116/http://labs.calyptix.com/haval.php)                       | ✔️ |
 | [JH](https://www3.ntu.edu.sg/home/wuhj/research/jh/index.html)                                               | ✔️ |

+ 0 - 382
core/crypto/gost/gost.odin

@@ -1,382 +0,0 @@
-package gost
-
-/*
-    Copyright 2021 zhibog
-    Made available under the BSD-3 license.
-
-    List of contributors:
-        zhibog, dotbmp:  Initial implementation.
-
-    Implementation of the GOST hashing algorithm, as defined in RFC 5831 <https://datatracker.ietf.org/doc/html/rfc5831>
-*/
-
-import "core:mem"
-import "core:os"
-import "core:io"
-
-/*
-    High level API
-*/
-
-DIGEST_SIZE :: 32
-
-// hash_string will hash the given input and return the
-// computed hash
-hash_string :: proc(data: string) -> [DIGEST_SIZE]byte {
-    return hash_bytes(transmute([]byte)(data))
-}
-
-// hash_bytes will hash the given input and return the
-// computed hash
-hash_bytes :: proc(data: []byte) -> [DIGEST_SIZE]byte {
-    hash: [DIGEST_SIZE]byte
-    ctx: Gost_Context
-    init(&ctx)
-    update(&ctx, data)
-    final(&ctx, hash[:])
-    return hash
-}
-
-// hash_string_to_buffer will hash the given input and assign the
-// computed hash to the second parameter.
-// It requires that the destination buffer is at least as big as the digest size
-hash_string_to_buffer :: proc(data: string, hash: []byte) {
-    hash_bytes_to_buffer(transmute([]byte)(data), hash)
-}
-
-// hash_bytes_to_buffer will hash the given input and write the
-// computed hash into the second parameter.
-// It requires that the destination buffer is at least as big as the digest size
-hash_bytes_to_buffer :: proc(data, hash: []byte) {
-    assert(len(hash) >= DIGEST_SIZE, "Size of destination buffer is smaller than the digest size")
-    ctx: Gost_Context
-    init(&ctx)
-    update(&ctx, data)
-    final(&ctx, hash)
-}
-
-// hash_stream will read the stream in chunks and compute a
-// hash from its contents
-hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
-    hash: [DIGEST_SIZE]byte
-    ctx: Gost_Context
-    init(&ctx)
-    buf := make([]byte, 512)
-    defer delete(buf)
-    read := 1
-    for read > 0 {
-        read, _ = io.read(s, buf)
-        if read > 0 {
-            update(&ctx, buf[:read])
-        } 
-    }
-    final(&ctx, hash[:])
-    return hash, true
-}
-
-// hash_file will read the file provided by the given handle
-// and compute a hash
-hash_file :: proc(hd: os.Handle, load_at_once := false) -> ([DIGEST_SIZE]byte, bool) {
-    if !load_at_once {
-        return hash_stream(os.stream_from_handle(hd))
-    } else {
-        if buf, ok := os.read_entire_file(hd); ok {
-            return hash_bytes(buf[:]), ok
-        }
-    }
-    return [DIGEST_SIZE]byte{}, false
-}
-
-hash :: proc {
-    hash_stream,
-    hash_file,
-    hash_bytes,
-    hash_string,
-    hash_bytes_to_buffer,
-    hash_string_to_buffer,
-}
-
-/*
-    Low level API
-*/
-
-init :: proc "contextless" (ctx: ^Gost_Context) {
-    sbox: [8][16]u32 = {
-        { 10, 4,  5,  6,  8,  1,  3,  7,  13, 12, 14, 0,  9,  2,  11, 15 },
-        { 5,  15, 4,  0,  2,  13, 11, 9,  1,  7,  6,  3,  12, 14, 10, 8  },
-        { 7,  15, 12, 14, 9,  4,  1,  0,  3,  11, 5,  2,  6,  10, 8,  13 },
-        { 4,  10, 7,  12, 0,  15, 2,  8,  14, 1,  6,  5,  13, 11, 9,  3  },
-        { 7,  6,  4,  11, 9,  12, 2,  10, 1,  8,  0,  14, 15, 13, 3,  5  },
-        { 7,  6,  2,  4,  13, 9,  15, 0,  10, 1,  5,  11, 8,  14, 12, 3  },
-        { 13, 14, 4,  1,  7,  0,  5,  10, 3,  12, 8,  15, 6,  2,  9,  11 },
-        { 1,  3,  10, 9,  5,  11, 4,  15, 8,  6,  7,  14, 13, 0,  2,  12 },
-    }
-
-    i := 0
-    for a := 0; a < 16; a += 1 {
-        ax := sbox[1][a] << 15
-        bx := sbox[3][a] << 23
-        cx := sbox[5][a]
-        cx = (cx >> 1) | (cx << 31)
-        dx := sbox[7][a] << 7
-        for b := 0; b < 16; b, i = b + 1, i + 1 {
-            SBOX_1[i] = ax | (sbox[0][b] << 11)
-            SBOX_2[i] = bx | (sbox[2][b] << 19)
-            SBOX_3[i] = cx | (sbox[4][b] << 27)
-            SBOX_4[i] = dx | (sbox[6][b] << 3)
-        }
-    }
-}
-
-update :: proc(ctx: ^Gost_Context, data: []byte) {
-    length := byte(len(data))
-    j: byte
-
-    i := ctx.partial_bytes
-    for i < 32 && j < length {
-        ctx.partial[i] = data[j]
-        i, j = i + 1, j + 1
-    }
-
-    if i < 32 {
-        ctx.partial_bytes = i
-        return
-    }
-    bytes(ctx, ctx.partial[:], 256)
-
-    for (j + 32) < length {
-        bytes(ctx, data[j:], 256)
-        j += 32
-    }
-
-    i = 0
-    for j < length {
-        ctx.partial[i] = data[j]
-        i, j = i + 1, j + 1
-    }
-    ctx.partial_bytes = i
-}
-
-final :: proc(ctx: ^Gost_Context, hash: []byte) {
-    if ctx.partial_bytes > 0 {
-        mem.set(&ctx.partial[ctx.partial_bytes], 0, 32 - int(ctx.partial_bytes))
-        bytes(ctx, ctx.partial[:], u32(ctx.partial_bytes) << 3)
-    }
-  
-    compress(ctx.hash[:], ctx.len[:])
-    compress(ctx.hash[:], ctx.sum[:])
-
-    for i, j := 0, 0; i < 8; i, j = i + 1, j + 4 {
-        hash[j]     = byte(ctx.hash[i])
-        hash[j + 1] = byte(ctx.hash[i] >> 8)
-        hash[j + 2] = byte(ctx.hash[i] >> 16)
-        hash[j + 3] = byte(ctx.hash[i] >> 24)
-    }
-}
-
-/*
-    GOST implementation
-*/
-
-Gost_Context :: struct {
-    sum:           [8]u32,
-    hash:          [8]u32,
-    len:           [8]u32,
-    partial:       [32]byte,
-    partial_bytes: byte,
-}
-
-SBOX_1: [256]u32
-SBOX_2: [256]u32
-SBOX_3: [256]u32
-SBOX_4: [256]u32
-
-ENCRYPT_ROUND :: #force_inline proc "contextless" (l, r, t, k1, k2: u32) -> (u32, u32, u32) {
-    l, r, t := l, r, t
-    t  = (k1) + r
-    l ~= SBOX_1[t & 0xff] ~ SBOX_2[(t >> 8) & 0xff] ~ SBOX_3[(t >> 16) & 0xff] ~ SBOX_4[t >> 24]
-    t  = (k2) + l
-    r ~= SBOX_1[t & 0xff] ~ SBOX_2[(t >> 8) & 0xff] ~ SBOX_3[(t >> 16) & 0xff] ~ SBOX_4[t >> 24]
-    return l, r, t
-}
-
-ENCRYPT :: #force_inline proc "contextless" (a, b, c: u32, key: []u32) -> (l, r, t: u32) {
-    l, r, t = ENCRYPT_ROUND(a, b, c, key[0], key[1])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[2], key[3])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[4], key[5])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[6], key[7])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[0], key[1])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[2], key[3])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[4], key[5])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[6], key[7])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[0], key[1])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[2], key[3])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[4], key[5])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[6], key[7])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[7], key[6])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[5], key[4])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[3], key[2])
-    l, r, t = ENCRYPT_ROUND(l, r, t, key[1], key[0])
-    t = r
-    r = l
-    l = t
-    return
-}
-
-bytes :: proc(ctx: ^Gost_Context, buf: []byte, bits: u32) {
-    a, c: u32
-    m: [8]u32
-
-    for i, j := 0, 0; i < 8; i += 1 {
-        a = u32(buf[j]) | u32(buf[j + 1]) << 8 | u32(buf[j + 2]) << 16 | u32(buf[j + 3]) << 24
-        j += 4
-        m[i] = a
-        c = a + c + ctx.sum[i]
-        ctx.sum[i] = c
-        c = c < a ? 1 : 0
-    }
-
-    compress(ctx.hash[:], m[:])
-    ctx.len[0] += bits
-    if ctx.len[0] < bits {
-        ctx.len[1] += 1
-    }
-}
-
-compress :: proc(h, m: []u32) {
-    key, u, v, w, s: [8]u32
-
-    copy(u[:], h)
-    copy(v[:], m)
-
-    for i := 0; i < 8; i += 2 {
-        w[0] = u[0] ~ v[0]
-        w[1] = u[1] ~ v[1]
-        w[2] = u[2] ~ v[2]
-        w[3] = u[3] ~ v[3]
-        w[4] = u[4] ~ v[4]
-        w[5] = u[5] ~ v[5]
-        w[6] = u[6] ~ v[6]
-        w[7] = u[7] ~ v[7]
-
-        key[0] = (w[0] & 0x000000ff)       | (w[2] & 0x000000ff) <<  8 | (w[4] & 0x000000ff) << 16 | (w[6] & 0x000000ff) << 24
-        key[1] = (w[0] & 0x0000ff00) >>  8 | (w[2] & 0x0000ff00)       | (w[4] & 0x0000ff00) <<  8 | (w[6] & 0x0000ff00) << 16
-        key[2] = (w[0] & 0x00ff0000) >> 16 | (w[2] & 0x00ff0000) >>  8 | (w[4] & 0x00ff0000)       | (w[6] & 0x00ff0000) <<  8
-        key[3] = (w[0] & 0xff000000) >> 24 | (w[2] & 0xff000000) >> 16 | (w[4] & 0xff000000) >>  8 | (w[6] & 0xff000000)
-        key[4] = (w[1] & 0x000000ff)       | (w[3] & 0x000000ff) <<  8 | (w[5] & 0x000000ff) << 16 | (w[7] & 0x000000ff) << 24
-        key[5] = (w[1] & 0x0000ff00) >>  8 | (w[3] & 0x0000ff00)       | (w[5] & 0x0000ff00) <<  8 | (w[7] & 0x0000ff00) << 16
-        key[6] = (w[1] & 0x00ff0000) >> 16 | (w[3] & 0x00ff0000) >>  8 | (w[5] & 0x00ff0000)       | (w[7] & 0x00ff0000) <<  8
-        key[7] = (w[1] & 0xff000000) >> 24 | (w[3] & 0xff000000) >> 16 | (w[5] & 0xff000000) >>  8 | (w[7] & 0xff000000)
-
-        r := h[i]
-        l := h[i + 1]
-        t: u32
-        l, r, t = ENCRYPT(l, r, 0, key[:])
-
-        s[i] = r
-        s[i + 1] = l
-
-        if i == 6 {
-            break
-        }
-
-        l    = u[0] ~ u[2]
-        r    = u[1] ~ u[3]
-        u[0] = u[2]
-        u[1] = u[3]
-        u[2] = u[4]
-        u[3] = u[5]
-        u[4] = u[6]
-        u[5] = u[7]
-        u[6] = l
-        u[7] = r
-
-        if i == 2 {
-            u[0] ~= 0xff00ff00
-            u[1] ~= 0xff00ff00
-            u[2] ~= 0x00ff00ff
-            u[3] ~= 0x00ff00ff
-            u[4] ~= 0x00ffff00
-            u[5] ~= 0xff0000ff
-            u[6] ~= 0x000000ff
-            u[7] ~= 0xff00ffff
-        }
-
-        l    = v[0]
-        r    = v[2]
-        v[0] = v[4]
-        v[2] = v[6]
-        v[4] = l ~ r
-        v[6] = v[0] ~ r
-        l    = v[1]
-        r    = v[3]
-        v[1] = v[5]
-        v[3] = v[7]
-        v[5] = l ~ r
-        v[7] = v[1] ~ r
-    }
-
-    u[0] = m[0] ~ s[6]
-    u[1] = m[1] ~ s[7]
-    u[2] = m[2] ~ (s[0] << 16) ~ (s[0] >> 16) ~ (s[0] & 0xffff) ~ 
-        (s[1] & 0xffff) ~ (s[1] >> 16) ~ (s[2] << 16) ~ s[6] ~ (s[6] << 16) ~
-        (s[7] & 0xffff0000) ~ (s[7] >> 16)
-    u[3] = m[3] ~ (s[0] & 0xffff) ~ (s[0] << 16) ~ (s[1] & 0xffff) ~
-        (s[1] << 16) ~ (s[1] >> 16) ~ (s[2] << 16) ~ (s[2] >> 16) ~
-        (s[3] << 16) ~ s[6] ~ (s[6] << 16) ~ (s[6] >> 16) ~ (s[7] & 0xffff) ~
-        (s[7] << 16) ~ (s[7] >> 16)
-    u[4] = m[4] ~
-        (s[0] & 0xffff0000) ~ (s[0] << 16) ~ (s[0] >> 16) ~
-        (s[1] & 0xffff0000) ~ (s[1] >> 16) ~ (s[2] << 16) ~ (s[2] >> 16) ~
-        (s[3] << 16) ~ (s[3] >> 16) ~ (s[4] << 16) ~ (s[6] << 16) ~
-        (s[6] >> 16) ~(s[7] & 0xffff) ~ (s[7] << 16) ~ (s[7] >> 16)
-    u[5] = m[5] ~ (s[0] << 16) ~ (s[0] >> 16) ~ (s[0] & 0xffff0000) ~
-        (s[1] & 0xffff) ~ s[2] ~ (s[2] >> 16) ~ (s[3] << 16) ~ (s[3] >> 16) ~
-        (s[4] << 16) ~ (s[4] >> 16) ~ (s[5] << 16) ~  (s[6] << 16) ~
-        (s[6] >> 16) ~ (s[7] & 0xffff0000) ~ (s[7] << 16) ~ (s[7] >> 16)
-    u[6] = m[6] ~ s[0] ~ (s[1] >> 16) ~ (s[2] << 16) ~ s[3] ~ (s[3] >> 16) ~
-        (s[4] << 16) ~ (s[4] >> 16) ~ (s[5] << 16) ~ (s[5] >> 16) ~ s[6] ~
-        (s[6] << 16) ~ (s[6] >> 16) ~ (s[7] << 16)
-    u[7] = m[7] ~ (s[0] & 0xffff0000) ~ (s[0] << 16) ~ (s[1] & 0xffff) ~
-        (s[1] << 16) ~ (s[2] >> 16) ~ (s[3] << 16) ~ s[4] ~ (s[4] >> 16) ~
-        (s[5] << 16) ~ (s[5] >> 16) ~ (s[6] >> 16) ~ (s[7] & 0xffff) ~
-        (s[7] << 16) ~ (s[7] >> 16)
-
-    v[0] = h[0] ~ (u[1] << 16) ~ (u[0] >> 16)
-    v[1] = h[1] ~ (u[2] << 16) ~ (u[1] >> 16)
-    v[2] = h[2] ~ (u[3] << 16) ~ (u[2] >> 16)
-    v[3] = h[3] ~ (u[4] << 16) ~ (u[3] >> 16)
-    v[4] = h[4] ~ (u[5] << 16) ~ (u[4] >> 16)
-    v[5] = h[5] ~ (u[6] << 16) ~ (u[5] >> 16)
-    v[6] = h[6] ~ (u[7] << 16) ~ (u[6] >> 16)
-    v[7] = h[7] ~ (u[0] & 0xffff0000) ~ (u[0] << 16) ~ (u[7] >> 16) ~ (u[1] & 0xffff0000) ~ (u[1] << 16) ~ (u[6] << 16) ~ (u[7] & 0xffff0000)
-
-    h[0] = (v[0] & 0xffff0000) ~ (v[0] << 16) ~ (v[0] >> 16) ~ (v[1] >> 16) ~
-        (v[1] & 0xffff0000) ~ (v[2] << 16) ~ (v[3] >> 16) ~ (v[4] << 16) ~
-        (v[5] >> 16) ~ v[5] ~ (v[6] >> 16) ~ (v[7] << 16) ~ (v[7] >> 16) ~
-        (v[7] & 0xffff)
-    h[1] = (v[0] << 16) ~ (v[0] >> 16) ~ (v[0] & 0xffff0000) ~ (v[1] & 0xffff) ~
-        v[2] ~ (v[2] >> 16) ~ (v[3] << 16) ~ (v[4] >> 16) ~ (v[5] << 16) ~
-        (v[6] << 16) ~ v[6] ~ (v[7] & 0xffff0000) ~ (v[7] >> 16)
-    h[2] = (v[0] & 0xffff) ~ (v[0] << 16) ~ (v[1] << 16) ~ (v[1] >> 16) ~
-        (v[1] & 0xffff0000) ~ (v[2] << 16) ~ (v[3] >> 16) ~ v[3] ~ (v[4] << 16) ~
-        (v[5] >> 16) ~ v[6] ~ (v[6] >> 16) ~ (v[7] & 0xffff) ~ (v[7] << 16) ~
-        (v[7] >> 16)
-    h[3] = (v[0] << 16) ~ (v[0] >> 16) ~ (v[0] & 0xffff0000) ~
-        (v[1] & 0xffff0000) ~ (v[1] >> 16) ~ (v[2] << 16) ~ (v[2] >> 16) ~ v[2] ~
-        (v[3] << 16) ~ (v[4] >> 16) ~ v[4] ~ (v[5] << 16) ~ (v[6] << 16) ~
-        (v[7] & 0xffff) ~ (v[7] >> 16)
-    h[4] = (v[0] >> 16) ~ (v[1] << 16) ~ v[1] ~ (v[2] >> 16) ~ v[2] ~
-        (v[3] << 16) ~ (v[3] >> 16) ~ v[3] ~ (v[4] << 16) ~ (v[5] >> 16) ~
-        v[5] ~ (v[6] << 16) ~ (v[6] >> 16) ~ (v[7] << 16)
-    h[5] = (v[0] << 16) ~ (v[0] & 0xffff0000) ~ (v[1] << 16) ~ (v[1] >> 16) ~
-        (v[1] & 0xffff0000) ~ (v[2] << 16) ~ v[2] ~ (v[3] >> 16) ~ v[3] ~
-        (v[4] << 16) ~ (v[4] >> 16) ~ v[4] ~ (v[5] << 16) ~ (v[6] << 16) ~
-        (v[6] >> 16) ~ v[6] ~ (v[7] << 16) ~ (v[7] >> 16) ~ (v[7] & 0xffff0000)
-    h[6] = v[0] ~ v[2] ~ (v[2] >> 16) ~ v[3] ~ (v[3] << 16) ~ v[4] ~
-        (v[4] >> 16) ~ (v[5] << 16) ~ (v[5] >> 16) ~ v[5] ~ (v[6] << 16) ~
-        (v[6] >> 16) ~ v[6] ~ (v[7] << 16) ~ v[7]
-    h[7] = v[0] ~ (v[0] >> 16) ~ (v[1] << 16) ~ (v[1] >> 16) ~ (v[2] << 16) ~
-        (v[3] >> 16) ~ v[3] ~ (v[4] << 16) ~ v[4] ~ (v[5] >> 16) ~ v[5] ~
-        (v[6] << 16) ~ (v[6] >> 16) ~ (v[7] << 16) ~ v[7]
-}

+ 0 - 2
examples/all/all_main.odin

@@ -27,7 +27,6 @@ import blake2b          "core:crypto/blake2b"
 import blake2s          "core:crypto/blake2s"
 import chacha20         "core:crypto/chacha20"
 import chacha20poly1305 "core:crypto/chacha20poly1305"
-import gost             "core:crypto/gost"
 import groestl          "core:crypto/groestl"
 import haval            "core:crypto/haval"
 import jh               "core:crypto/jh"
@@ -153,7 +152,6 @@ _ :: blake2b
 _ :: blake2s
 _ :: chacha20
 _ :: chacha20poly1305
-_ :: gost
 _ :: groestl
 _ :: haval
 _ :: jh

+ 0 - 2
examples/all/all_vendor.odin

@@ -2,7 +2,6 @@ package all
 
 import botan_bindings "vendor:botan/bindings"
 import botan_blake2b  "vendor:botan/blake2b"
-import gost           "vendor:botan/gost"
 import keccak         "vendor:botan/keccak"
 import md4            "vendor:botan/md4"
 import md5            "vendor:botan/md5"
@@ -48,7 +47,6 @@ import fontstash "vendor:fontstash"
 
 _ :: botan_bindings
 _ :: botan_blake2b
-_ :: gost
 _ :: keccak
 _ :: md4
 _ :: md5

+ 0 - 22
tests/core/crypto/test_core_crypto.odin

@@ -30,7 +30,6 @@ import "core:crypto/blake2b"
 import "core:crypto/blake2s"
 import "core:crypto/tiger"
 import "core:crypto/tiger2"
-import "core:crypto/gost"
 import "core:crypto/streebog"
 import "core:crypto/sm3"
 import "core:crypto/jh"
@@ -82,7 +81,6 @@ main :: proc() {
 	test_keccak_384(&t)
 	test_keccak_512(&t)
 	test_whirlpool(&t)
-	test_gost(&t)
 	test_streebog_256(&t)
 	test_streebog_512(&t)
 	test_blake2b(&t)
@@ -518,26 +516,6 @@ test_whirlpool :: proc(t: ^testing.T) {
 	}
 }
 
-@(test)
-test_gost :: proc(t: ^testing.T) {
-	test_vectors := [?]TestHash {
-		TestHash{"981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0", ""},
-		TestHash{"e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011", "a"},
-		TestHash{"b285056dbf18d7392d7677369524dd14747459ed8143997e163b2986f92fd42c", "abc"},
-		TestHash{"bc6041dd2aa401ebfa6e9886734174febdb4729aa972d60f549ac39b29721ba0", "message digest"},
-		TestHash{"9004294a361a508c586fe53d1f1b02746765e71b765472786e4770d565830a76", "The quick brown fox jumps over the lazy dog"},
-		TestHash{"73b70a39497de53a6e08c67b6d4db853540f03e9389299d9b0156ef7e85d0f61", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
-		TestHash{"6bc7b38989b28cf93ae8842bf9d752905910a7528a61e5bce0782de43e610c90", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"},
-		TestHash{"2cefc2f7b7bdc514e18ea57fa74ff357e7fa17d652c75f69cb1be7893ede48eb", "This is message, length=32 bytes"},
-		TestHash{"c3730c5cbccacf915ac292676f21e8bd4ef75331d9405e5f1a61dc3130a65011", "Suppose the original message has length = 50 bytes"},
-	}
-	for v, _ in test_vectors {
-		computed     := gost.hash(v.str)
-		computed_str := hex_string(computed[:])
-		expect(t, computed_str == v.hash, fmt.tprintf("Expected: %s for input of %s, but got %s instead", v.hash, v.str, computed_str))
-	}
-}
-
 @(test)
 test_streebog_256 :: proc(t: ^testing.T) {
 	test_vectors := [?]TestHash {

+ 0 - 22
tests/vendor/botan/test_vendor_botan.odin

@@ -28,7 +28,6 @@ import "vendor:botan/whirlpool"
 import "vendor:botan/ripemd"
 import "vendor:botan/blake2b"
 import "vendor:botan/tiger"
-import "vendor:botan/gost"
 import "vendor:botan/streebog"
 import "vendor:botan/sm3"
 import "vendor:botan/skein512"
@@ -74,7 +73,6 @@ main :: proc() {
     // test_shake_256(&t)
     test_keccak_512(&t)
     test_whirlpool(&t)
-    test_gost(&t)
     test_streebog_256(&t)
     test_streebog_512(&t)
     test_blake2b(&t)
@@ -401,26 +399,6 @@ test_whirlpool :: proc(t: ^testing.T) {
     }
 }
 
-@(test)
-test_gost :: proc(t: ^testing.T) {
-    test_vectors := [?]TestHash {
-        TestHash{"981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0", ""},
-        TestHash{"e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011", "a"},
-        TestHash{"b285056dbf18d7392d7677369524dd14747459ed8143997e163b2986f92fd42c", "abc"},
-        TestHash{"bc6041dd2aa401ebfa6e9886734174febdb4729aa972d60f549ac39b29721ba0", "message digest"},
-        TestHash{"9004294a361a508c586fe53d1f1b02746765e71b765472786e4770d565830a76", "The quick brown fox jumps over the lazy dog"},
-        TestHash{"73b70a39497de53a6e08c67b6d4db853540f03e9389299d9b0156ef7e85d0f61", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
-        TestHash{"6bc7b38989b28cf93ae8842bf9d752905910a7528a61e5bce0782de43e610c90", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"},
-        TestHash{"2cefc2f7b7bdc514e18ea57fa74ff357e7fa17d652c75f69cb1be7893ede48eb", "This is message, length=32 bytes"},
-        TestHash{"c3730c5cbccacf915ac292676f21e8bd4ef75331d9405e5f1a61dc3130a65011", "Suppose the original message has length = 50 bytes"},
-    }
-    for v, _ in test_vectors {
-        computed     := gost.hash(v.str)
-        computed_str := hex_string(computed[:])
-        expect(t, computed_str == v.hash, fmt.tprintf("Expected: %s for input of %s, but got %s instead", v.hash, v.str, computed_str))
-    }
-}
-
 @(test)
 test_streebog_256 :: proc(t: ^testing.T) {
     test_vectors := [?]TestHash {

+ 0 - 1
vendor/botan/README.md

@@ -9,7 +9,6 @@ Wrappers for hashing algorithms have been added to match the API within the Odin
 | Algorithm                                                                                                    |                  |
 |:-------------------------------------------------------------------------------------------------------------|:-----------------|
 | [BLAKE2B](https://datatracker.ietf.org/doc/html/rfc7693)                                                     | &#10004;&#65039; |
-| [GOST](https://datatracker.ietf.org/doc/html/rfc5831)                                                        | &#10004;&#65039; |
 | [Keccak](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf)                                           | &#10004;&#65039; |
 | [MD4](https://datatracker.ietf.org/doc/html/rfc1320)                                                         | &#10004;&#65039; |
 | [MD5](https://datatracker.ietf.org/doc/html/rfc1321)                                                         | &#10004;&#65039; |

+ 0 - 1
vendor/botan/bindings/botan.odin

@@ -82,7 +82,6 @@ HASH_MD5            :: "MD5"
 HASH_TIGER_128      :: "Tiger(16,3)"
 HASH_TIGER_160      :: "Tiger(20,3)"
 HASH_TIGER_192      :: "Tiger(24,3)"
-HASH_GOST           :: "GOST-34.11"
 HASH_STREEBOG_256   :: "Streebog-256"
 HASH_STREEBOG_512   :: "Streebog-512"
 HASH_SM3            :: "SM3"

+ 0 - 121
vendor/botan/gost/gost.odin

@@ -1,121 +0,0 @@
-package vendor_gost
-
-/*
-    Copyright 2021 zhibog
-    Made available under the BSD-3 license.
-
-    List of contributors:
-        zhibog:  Initial implementation.
-
-    Interface for the GOST hashing algorithm.
-    The hash will be computed via bindings to the Botan crypto library
-*/
-
-import "core:os"
-import "core:io"
-
-import botan "../bindings"
-
-/*
-    High level API
-*/
-
-DIGEST_SIZE :: 32
-
-// hash_string will hash the given input and return the
-// computed hash
-hash_string :: proc "contextless" (data: string) -> [DIGEST_SIZE]byte {
-    return hash_bytes(transmute([]byte)(data))
-}
-
-// hash_bytes will hash the given input and return the
-// computed hash
-hash_bytes :: proc "contextless" (data: []byte) -> [DIGEST_SIZE]byte {
-    hash: [DIGEST_SIZE]byte
-    ctx: botan.hash_t
-    botan.hash_init(&ctx, botan.HASH_GOST, 0)
-    botan.hash_update(ctx, len(data) == 0 ? nil : &data[0], uint(len(data)))
-    botan.hash_final(ctx, &hash[0])
-    botan.hash_destroy(ctx)
-    return hash
-}
-
-// hash_string_to_buffer will hash the given input and assign the
-// computed hash to the second parameter.
-// It requires that the destination buffer is at least as big as the digest size
-hash_string_to_buffer :: proc(data: string, hash: []byte) {
-    hash_bytes_to_buffer(transmute([]byte)(data), hash)
-}
-
-// hash_bytes_to_buffer will hash the given input and write the
-// computed hash into the second parameter.
-// It requires that the destination buffer is at least as big as the digest size
-hash_bytes_to_buffer :: proc(data, hash: []byte) {
-    assert(len(hash) >= DIGEST_SIZE, "Size of destination buffer is smaller than the digest size")
-    ctx: botan.hash_t
-    botan.hash_init(&ctx, botan.HASH_GOST, 0)
-    botan.hash_update(ctx, len(data) == 0 ? nil : &data[0], uint(len(data)))
-    botan.hash_final(ctx, &hash[0])
-    botan.hash_destroy(ctx)
-}
-
-// hash_stream will read the stream in chunks and compute a
-// hash from its contents
-hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
-    hash: [DIGEST_SIZE]byte
-    ctx: botan.hash_t
-    botan.hash_init(&ctx, botan.HASH_GOST, 0)
-    buf := make([]byte, 512)
-    defer delete(buf)
-    i := 1
-    for i > 0 {
-        i, _ = io.read(s, buf)
-        if i > 0 {
-            botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
-        } 
-    }
-    botan.hash_final(ctx, &hash[0])
-    botan.hash_destroy(ctx)
-    return hash, true 
-}
-
-// hash_file will read the file provided by the given handle
-// and compute a hash
-hash_file :: proc(hd: os.Handle, load_at_once := false) -> ([DIGEST_SIZE]byte, bool) {
-    if !load_at_once {
-        return hash_stream(os.stream_from_handle(hd))
-    } else {
-        if buf, ok := os.read_entire_file(hd); ok {
-            return hash_bytes(buf[:]), ok
-        }
-    }
-    return [DIGEST_SIZE]byte{}, false
-}
-
-hash :: proc {
-    hash_stream,
-    hash_file,
-    hash_bytes,
-    hash_string,
-    hash_bytes_to_buffer,
-    hash_string_to_buffer,
-}
-
-/*
-    Low level API
-*/
-
-Gost_Context :: botan.hash_t
-
-init :: proc "contextless" (ctx: ^botan.hash_t) {
-    botan.hash_init(ctx, botan.HASH_GOST, 0)
-}
-
-update :: proc "contextless" (ctx: ^botan.hash_t, data: []byte) {
-    botan.hash_update(ctx^, len(data) == 0 ? nil : &data[0], uint(len(data)))
-}
-
-final :: proc "contextless" (ctx: ^botan.hash_t, hash: []byte) {
-    botan.hash_final(ctx^, &hash[0])
-    botan.hash_destroy(ctx^)
-}