Граф коммитов

7 Коммитов

Автор SHA1 Сообщение Дата
Daniel Mangum e90f1e17ee cryptobyte: add uint48 methods
Adds uint48 methods for cryptobyte.Builder and cryptobyte.String.
Supporting 48-bit unsigned integers is useful for working with protocols
that use them for sequence numbers, such as DTLS.

Fixes golang/go#61275

Change-Id: Ibe49422d37644b9212b28b123dc5e01850f7b05b
GitHub-Last-Rev: 11b388c240
GitHub-Pull-Request: golang/crypto#265
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/508675
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-07 16:27:37 +00:00
hopehook 5757bc0c55 cryptobyte: add ReadUint64 and AddUint64
Fixes golang/go#53481.

Change-Id: Ic00eef498d1d3b5b0ca5c9c526fac7c26de30cf2
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/421014
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-08-24 17:17:10 +00:00
Philipp c05539cddb cryptobyte: fix typo in test
Change-Id: I03178eca962c29ad03fd9b2fb57ad35c53c99860
GitHub-Last-Rev: 21a7a75192
GitHub-Pull-Request: golang/crypto#66
Reviewed-on: https://go-review.googlesource.com/c/151277
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-26 14:41:56 +00:00
Filippo Valsorda 3d3f9f4138 cryptobyte: don't ignore bytes added to BuilderContinuations of fixed-size Builders
Builders created with NewFixedBuilder were broken when used with
BuilderContinuations. The length of the bytes written to the
continuation would get added correctly to the parent, but the actual
content would be discarded.

For example, the BytesOrPanic() in TestFixedBuilderLengthPrefixed would
return [00 08] instead of [00 08 ff ff ff ff ff ff ff ff].

Change-Id: I80837a9bf3562751addcb827274649d9f52fc79a
Reviewed-on: https://go-review.googlesource.com/c/148882
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2018-11-12 20:29:54 +00:00
Filippo Valsorda b078efbc80 cryptobyte: add (*Builder).Unwrite and (*Builder).SetError
Unwrite allows programs to rollback builders more reliably and
efficiently than by copying a Builder (which might waste an allocation
and depends on internal behavior). This is useful for example to remove
a length-prefixed field if it ends up being empty.

SetError allows simple Builder extensions to set errors without making
MarshalingValue wrappers.

Based on the experience of CL 144115.

Change-Id: I9a785b81b51b15af49418b5bdb71c4ef222ccc46
Reviewed-on: https://go-review.googlesource.com/c/145317
Reviewed-by: Adam Langley <agl@golang.org>
2018-10-29 21:22:43 +00:00
Adam Langley 2bcb7b5baf cryptobyte: various API and documentation updates.
Change-Id: I83236ecea0774d4ec49e978a391eb3ff5dabdeb6
Reviewed-on: https://go-review.googlesource.com/57810
Reviewed-by: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2017-09-12 17:47:39 +00:00
Martin Kreichgauer 728b753d01 cryptobyte: new package.
cryptobyte is a helper library for building and parsing byte strings,
specifically for TLS and ASN.1.

Change-Id: I046b94773f6781153784c79f3d81e6d464eaebe0
Reviewed-on: https://go-review.googlesource.com/36123
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-07 00:40:51 +00:00