| 1 | // Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | module aes |
| 5 | |
| 6 | import crypto.cipher |
| 7 | |
| 8 | // new_cipher_generic creates and returns a new cipher.Block |
| 9 | // this is the generiv v version, no arch optimisations |
| 10 | fn new_cipher_generic(key []u8) cipher.Block { |
| 11 | n := key.len + 28 |
| 12 | mut c := AesCipher{ |
| 13 | enc: []u32{len: n} |
| 14 | dec: []u32{len: n} |
| 15 | } |
| 16 | expand_key_generic(key, mut c.enc, mut c.dec) |
| 17 | return c |
| 18 | } |
| 19 | |