Key: we already do len checking in C

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-02-08 14:39:59 +01:00
parent a231410c52
commit 407b367c8d
1 changed files with 0 additions and 6 deletions

View File

@ -23,9 +23,6 @@ extension Data {
} }
init?(hexKey hexString: String) { init?(hexKey hexString: String) {
if hexString.utf8.count != WG_KEY_LEN_HEX - 1 {
return nil
}
self.init(repeating: 0, count: Int(WG_KEY_LEN)) self.init(repeating: 0, count: Int(WG_KEY_LEN))
if !self.withUnsafeMutableBytes { key_from_hex($0, hexString) } { if !self.withUnsafeMutableBytes { key_from_hex($0, hexString) } {
@ -48,9 +45,6 @@ extension Data {
} }
init?(base64Key base64String: String) { init?(base64Key base64String: String) {
if base64String.utf8.count != WG_KEY_LEN_BASE64 - 1 {
return nil
}
self.init(repeating: 0, count: Int(WG_KEY_LEN)) self.init(repeating: 0, count: Int(WG_KEY_LEN))
if !self.withUnsafeMutableBytes { key_from_base64($0, base64String) } { if !self.withUnsafeMutableBytes { key_from_base64($0, base64String) } {