Update Wycheproof ecdh_secp256r1_test.json to v1 (#160)
This commit is contained in:
parent
25a68d63b7
commit
6be84be0bd
|
@ -293,7 +293,11 @@ extension ArraySlice where Element == UInt8 {
|
|||
self = self[self.index(after: subidentifierEndIndex)...]
|
||||
|
||||
// We need to compact the bits. These are 7-bit integers, which is really awkward.
|
||||
return UInt(sevenBitBigEndianBytes: oidSlice)
|
||||
guard let int = UInt(sevenBitBigEndianBytes: oidSlice) else {
|
||||
// too big to parse, happens for Wycheproof vectors with comment "large integer in oid"
|
||||
throw ECDHTestErrors.ParseSPKIFailure
|
||||
}
|
||||
return int
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,10 +317,13 @@ extension UInt {
|
|||
}
|
||||
}
|
||||
|
||||
init<Bytes: Collection>(sevenBitBigEndianBytes bytes: Bytes) where Bytes.Element == UInt8 {
|
||||
init?<Bytes: Collection>(sevenBitBigEndianBytes bytes: Bytes) where Bytes.Element == UInt8 {
|
||||
// We need to know how many bytes we _need_ to store this "int".
|
||||
guard ((bytes.count * 7) + 7) / 8 <= MemoryLayout<UInt>.size else {
|
||||
fatalError("Too big to parse")
|
||||
// Too big to parse, this happens for e.g. Wycheproof in testvector 'ecdh_secp256r1_test' for
|
||||
// tests with comment "large integer in oid", thus we let this
|
||||
// initializer be failable.
|
||||
return nil
|
||||
}
|
||||
|
||||
self = 0
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue