// PointDecodeFrom provides a generic implementation of Point.DecodeFrom, // based on Point.Decode, or Point.Pick if r is a Cipher or cipher.Stream. // The returned byte-count is valid only when decoding from a normal Reader, // not when picking from a pseudorandom source. func PointUnmarshalFrom(p abstract.Point, r io.Reader) (int, error) { if strm, ok := r.(cipher.Stream); ok { p.Pick(nil, strm) return -1, nil // no byte-count when picking randomly } buf := make([]byte, p.MarshalSize()) n, err := io.ReadFull(r, buf) if err != nil { return n, err } return n, p.UnmarshalBinary(buf) }