|
diff --git a/vendor/github.com/go-openapi/validate/default_validator.go b/vendor/github.com/go-openapi/validate/default_validator.go
index ebcd807137..5902cee5ca 100644
--- a/vendor/github.com/go-openapi/validate/default_validator.go
+++ b/vendor/github.com/go-openapi/validate/default_validator.go
@@ -4,9 +4,6 @@
package validate
import (
- "fmt"
- "strings"
-
"github.com/go-openapi/spec"
)
@@ -20,7 +17,7 @@ type defaultValidator struct {
// Validate validates the default values declared in the swagger spec.
func (d *defaultValidator) Validate() *Result {
- errs := pools.poolOfResults.BorrowResult() // will redeem when merged
+ errs := validatorPools.results.Borrow() // will redeem when merged
if d == nil || d.SpecValidator == nil {
return errs
@@ -44,28 +41,16 @@ func (d *defaultValidator) resetVisited() {
}
}
-func isVisited(path string, visitedSchemas map[string]struct{}) bool {
- _, found := visitedSchemas[path]
+func isVisited(path pathSegments, visitedSchemas map[string]struct{}) bool {
+ _, found := visitedSchemas[path.pointer()]
if found {
return true
}
- // search for overlapping paths
- var (
- parent string
- suffix string
- )
- const backtrackFromEnd = 2
- for i := len(path) - backtrackFromEnd; i >= 0; i-- {
- r := path[i]
- if r != '.' {
- continue
- }
-
- parent = path[0:i]
- suffix = path[i+1:]
-
- if strings.HasSuffix(parent, suffix) {
+ // search for overlapping paths: a trailing run of tokens that already
+ // appears at the end of what leads to it means we are going in circles.
+ for i := 1; i < len(path); i++ {
+ if path[:i].hasSuffix(path[i:]) {
return true
}
}
@@ -74,12 +59,12 @@ func isVisited(path string, visitedSchemas map[string]struct{}) bool {
}
// beingVisited asserts a schema is being visited.
-func (d *defaultValidator) beingVisited(path string) {
- d.visitedSchemas[path] = struct{}{}
+func (d *defaultValidator) beingVisited(path pathSegments) {
+ d.visitedSchemas[path.pointer()] = struct{}{}
}
// isVisited tells if a path has already been visited.
-func (d *defaultValidator) isVisited(path string) bool {
+func (d *defaultValidator) isVisited(path pathSegments) bool {
return isVisited(path, d.visitedSchemas)
}
@@ -88,15 +73,18 @@ func (d *defaultValidator) validateDefaultValueValidAgainstSchema() *Result {
// every default value that is specified must validate against the schema for that property
// headers, items, parameters, schema
- res := pools.poolOfResults.BorrowResult() // will redeem when merged
+ res := validatorPools.results.Borrow() // will redeem when merged
s := d.SpecValidator
- for method, pathItem := range s.expandedAnalyzer().Operations() {
- for path, op := range pathItem {
+ operations := s.expandedAnalyzer().Operations()
+ for _, method := range sortedKeys(operations) {
+ pathItem := operations[method]
+ for _, path := range sortedKeys(pathItem) {
+ op := pathItem[path]
// parameters
for _, param := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) {
if param.Default != nil && param.Required {
- res.AddWarnings(requiredHasDefaultMsg(param.Name, param.In))
+ res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), requiredHasDefaultMsg(param.Name, param.In))
}
// reset explored schemas to get depth-first recursive-proof exploration
@@ -107,33 +95,34 @@ func (d *defaultValidator) validateDefaultValueValidAgainstSchema() *Result {
if param.Default != nil && param.Schema == nil {
// check param default value is valid
red := newParamValidator(¶m, s.KnownFormats, d.schemaOptions).Validate(param.Default) //#nosec
+ red.relocate(s.parameterPath(path, method, param.In, param.Name).child(jsonDefault))
if red.HasErrorsOrWarnings() {
- res.AddErrors(defaultValueDoesNotValidateMsg(param.Name, param.In))
+ res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), defaultValueDoesNotValidateMsg(param.Name, param.In))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
// Recursively follows Items and Schemas
if param.Items != nil {
- red := d.validateDefaultValueItemsAgainstSchema(param.Name, param.In, ¶m, param.Items) //#nosec
+ red := d.validateDefaultValueItemsAgainstSchema(s.parameterPath(path, method, param.In, param.Name), param.In, ¶m, param.Items) //#nosec
if red.HasErrorsOrWarnings() {
- res.AddErrors(defaultValueItemsDoesNotValidateMsg(param.Name, param.In))
+ res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), defaultValueItemsDoesNotValidateMsg(param.Name, param.In))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
if param.Schema != nil {
// Validate default value against schema
- red := d.validateDefaultValueSchemaAgainstSchema(param.Name, param.In, param.Schema)
+ red := d.validateDefaultValueSchemaAgainstSchema(s.parameterPath(path, method, param.In, param.Name).structuralChild(jsonSchema), param.In, param.Schema)
if red.HasErrorsOrWarnings() {
- res.AddErrors(defaultValueDoesNotValidateMsg(param.Name, param.In))
+ res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), defaultValueDoesNotValidateMsg(param.Name, param.In))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
}
@@ -141,68 +130,74 @@ func (d *defaultValidator) validateDefaultValueValidAgainstSchema() *Result {
if op.Responses != nil {
if op.Responses.Default != nil {
// Same constraint on default Response
- res.Merge(d.validateDefaultInResponse(op.Responses.Default, jsonDefault, path, 0, op.ID))
+ res.Merge(d.validateDefaultInResponse(op.Responses.Default, jsonDefault, path, method, 0, op.ID))
}
// Same constraint on regular Responses
if op.Responses.StatusCodeResponses != nil { // Safeguard
- for code, r := range op.Responses.StatusCodeResponses {
- res.Merge(d.validateDefaultInResponse(&r, "response", path, code, op.ID)) //#nosec
+ for _, code := range sortedKeys(op.Responses.StatusCodeResponses) {
+ r := op.Responses.StatusCodeResponses[code]
+ res.Merge(d.validateDefaultInResponse(&r, "response", path, method, code, op.ID))
}
}
} else if op.ID != "" {
// Empty op.ID means there is no meaningful operation: no need to report a specific message
- res.AddErrors(noValidResponseMsg(op.ID))
+ res.addErrorsAt(operationPath(path, method), noValidResponseMsg(op.ID))
}
}
}
if s.spec.Spec().Definitions != nil { // Safeguard
// reset explored schemas to get depth-first recursive-proof exploration
d.resetVisited()
- for nm, sch := range s.spec.Spec().Definitions {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema("definitions."+nm, "body", &sch)) //#nosec
+ definitions := s.spec.Spec().Definitions
+ for _, nm := range sortedKeys(definitions) {
+ sch := definitions[nm]
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(newPathSegments(swaggerDefinitions, nm), "body", &sch))
}
}
return res
}
-func (d *defaultValidator) validateDefaultInResponse(resp *spec.Response, responseType, path string, responseCode int, operationID string) *Result {
+func (d *defaultValidator) validateDefaultInResponse(
+ resp *spec.Response, responseType, path, method string, responseCode int, operationID string,
+) *Result {
s := d.SpecValidator
- response, res := responseHelp.expandResponseRef(resp, path, s)
+ responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode)
+ response, res := responseHelp.expandResponseRef(resp, path, responsePath(path, method, responseCodeAsStr), s)
if !res.IsValid() {
return res
}
- responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode)
-
if response.Headers != nil { // Safeguard
- for nm, h := range response.Headers {
+ for _, nm := range sortedKeys(response.Headers) {
+ h := response.Headers[nm]
// reset explored schemas to get depth-first recursive-proof exploration
d.resetVisited()
if h.Default != nil {
red := newHeaderValidator(nm, &h, s.KnownFormats, d.schemaOptions).Validate(h.Default) //#nosec
+ red.relocate(responseHeaderPath(path, method, responseCodeAsStr, nm).child(jsonDefault))
if red.HasErrorsOrWarnings() {
- res.AddErrors(defaultValueHeaderDoesNotValidateMsg(operationID, nm, responseName))
+ res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), defaultValueHeaderDoesNotValidateMsg(operationID, nm, responseName))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
// Headers have inline definition, like params
if h.Items != nil {
- red := d.validateDefaultValueItemsAgainstSchema(nm, "header", &h, h.Items) //#nosec
+ red := d.validateDefaultValueItemsAgainstSchema(responseHeaderPath(path, method, responseCodeAsStr, nm), "header", &h, h.Items) //#nosec
if red.HasErrorsOrWarnings() {
- res.AddErrors(defaultValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName))
+ res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), defaultValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
if _, err := compileRegexp(h.Pattern); err != nil {
- res.AddErrors(invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err))
+ res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err))
}
// Headers don't have schema
@@ -212,62 +207,65 @@ func (d *defaultValidator) validateDefaultInResponse(resp *spec.Response, respon
// reset explored schemas to get depth-first recursive-proof exploration
d.resetVisited()
- red := d.validateDefaultValueSchemaAgainstSchema(responseCodeAsStr, "response", response.Schema)
+ red := d.validateDefaultValueSchemaAgainstSchema(
+ responsePath(path, method, responseCodeAsStr).structuralChild(jsonSchema), "response", response.Schema)
if red.HasErrorsOrWarnings() {
// Additional message to make sure the context of the error is not lost
- res.AddErrors(defaultValueInDoesNotValidateMsg(operationID, responseName))
+ res.addErrorsAt(responsePath(path, method, responseCodeAsStr), defaultValueInDoesNotValidateMsg(operationID, responseName))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
return res
}
-func (d *defaultValidator) validateDefaultValueSchemaAgainstSchema(path, in string, schema *spec.Schema) *Result {
+func (d *defaultValidator) validateDefaultValueSchemaAgainstSchema(path pathSegments, in string, schema *spec.Schema) *Result {
if schema == nil || d.isVisited(path) {
// Avoids recursing if we are already done with that check
return nil
}
d.beingVisited(path)
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
s := d.SpecValidator
if schema.Default != nil {
res.Merge(
- newSchemaValidator(schema, s.spec.Spec(), path+".default", s.KnownFormats, d.schemaOptions).Validate(schema.Default),
+ newSchemaValidator(schema, s.spec.Spec(), path.child(jsonDefault), s.KnownFormats, d.schemaOptions).Validate(schema.Default),
)
}
if schema.Items != nil {
if schema.Items.Schema != nil {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+".items.default", in, schema.Items.Schema))
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonItems), in, schema.Items.Schema))
}
// Multiple schemas in items
if schema.Items.Schemas != nil { // Safeguard
for i, sch := range schema.Items.Schemas {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(fmt.Sprintf("%s.items[%d].default", path, i), in, &sch)) //#nosec
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonItems).item(i), in, &sch)) //#nosec
}
}
}
if _, err := compileRegexp(schema.Pattern); err != nil {
- res.AddErrors(invalidPatternInMsg(path, in, schema.Pattern))
+ res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, schema.Pattern))
}
if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil {
// NOTE: we keep validating values, even though additionalItems is not supported by Swagger 2.0 (and 3.0 as well)
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+".additionalItems", in, schema.AdditionalItems.Schema))
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonAdditionalItems), in, schema.AdditionalItems.Schema))
}
- for propName, prop := range schema.Properties {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec
+ for _, propName := range sortedKeys(schema.Properties) {
+ prop := schema.Properties[propName]
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.structuralChild(jsonProperties).child(propName), in, &prop))
}
- for propName, prop := range schema.PatternProperties {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec
+ for _, propName := range sortedKeys(schema.PatternProperties) {
+ prop := schema.PatternProperties[propName]
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.structuralChild(jsonPatternProperties).child(propName), in, &prop))
}
if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+".additionalProperties", in, schema.AdditionalProperties.Schema))
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonAdditionalProperties), in, schema.AdditionalProperties.Schema))
}
if schema.AllOf != nil {
for i, aoSch := range schema.AllOf {
- res.Merge(d.validateDefaultValueSchemaAgainstSchema(fmt.Sprintf("%s.allOf[%d]", path, i), in, &aoSch)) //#nosec
+ res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonAllOf).item(i), in, &aoSch)) //#nosec
}
}
return res
@@ -275,8 +273,8 @@ func (d *defaultValidator) validateDefaultValueSchemaAgainstSchema(path, in stri
// NOTE: Temporary duplicated code. Need to refactor with examples
-func (d *defaultValidator) validateDefaultValueItemsAgainstSchema(path, in string, root any, items *spec.Items) *Result {
- res := pools.poolOfResults.BorrowResult()
+func (d *defaultValidator) validateDefaultValueItemsAgainstSchema(path pathSegments, in string, root any, items *spec.Items) *Result {
+ res := validatorPools.results.Borrow()
s := d.SpecValidator
if items != nil {
if items.Default != nil {
@@ -285,10 +283,10 @@ func (d *defaultValidator) validateDefaultValueItemsAgainstSchema(path, in strin
)
}
if items.Items != nil {
- res.Merge(d.validateDefaultValueItemsAgainstSchema(path+"[0].default", in, root, items.Items))
+ res.Merge(d.validateDefaultValueItemsAgainstSchema(path.item(0), in, root, items.Items))
}
if _, err := compileRegexp(items.Pattern); err != nil {
- res.AddErrors(invalidPatternInMsg(path, in, items.Pattern))
+ res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, items.Pattern))
}
}
return res
diff --git a/vendor/github.com/go-openapi/validate/example_validator.go b/vendor/github.com/go-openapi/validate/example_validator.go
index eb6b5ee5c7..0e193d5234 100644
--- a/vendor/github.com/go-openapi/validate/example_validator.go
+++ b/vendor/github.com/go-openapi/validate/example_validator.go
@@ -4,8 +4,6 @@
package validate
import (
- "fmt"
-
"github.com/go-openapi/spec"
)
@@ -24,7 +22,7 @@ type exampleValidator struct {
// - individual property
// - responses
func (ex *exampleValidator) Validate() *Result {
- errs := pools.poolOfResults.BorrowResult()
+ errs := validatorPools.results.Borrow()
if ex == nil || ex.SpecValidator == nil {
return errs
@@ -50,12 +48,12 @@ func (ex *exampleValidator) resetVisited() {
}
// beingVisited asserts a schema is being visited.
-func (ex *exampleValidator) beingVisited(path string) {
- ex.visitedSchemas[path] = struct{}{}
+func (ex *exampleValidator) beingVisited(path pathSegments) {
+ ex.visitedSchemas[path.pointer()] = struct{}{}
}
// isVisited tells if a path has already been visited.
-func (ex *exampleValidator) isVisited(path string) bool {
+func (ex *exampleValidator) isVisited(path pathSegments) bool {
return isVisited(path, ex.visitedSchemas)
}
@@ -65,11 +63,14 @@ func (ex *exampleValidator) validateExampleValueValidAgainstSchema() *Result {
// in: schemas, properties, object, items
// not in: headers, parameters without schema
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
s := ex.SpecValidator
- for method, pathItem := range s.expandedAnalyzer().Operations() {
- for path, op := range pathItem {
+ operations := s.expandedAnalyzer().Operations()
+ for _, method := range sortedKeys(operations) {
+ pathItem := operations[method]
+ for _, path := range sortedKeys(pathItem) {
+ op := pathItem[path]
// parameters
for _, param := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) {
@@ -84,33 +85,34 @@ func (ex *exampleValidator) validateExampleValueValidAgainstSchema() *Result {
if param.Example != nil && param.Schema == nil {
// check param default value is valid
red := newParamValidator(¶m, s.KnownFormats, ex.schemaOptions).Validate(param.Example) //#nosec
+ red.relocate(s.parameterPath(path, method, param.In, param.Name).child(swaggerExample))
if red.HasErrorsOrWarnings() {
- res.AddWarnings(exampleValueDoesNotValidateMsg(param.Name, param.In))
+ res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), exampleValueDoesNotValidateMsg(param.Name, param.In))
res.MergeAsWarnings(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
// Recursively follows Items and Schemas
if param.Items != nil {
- red := ex.validateExampleValueItemsAgainstSchema(param.Name, param.In, ¶m, param.Items) //#nosec
+ red := ex.validateExampleValueItemsAgainstSchema(s.parameterPath(path, method, param.In, param.Name), param.In, ¶m, param.Items) //#nosec
if red.HasErrorsOrWarnings() {
- res.AddWarnings(exampleValueItemsDoesNotValidateMsg(param.Name, param.In))
+ res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), exampleValueItemsDoesNotValidateMsg(param.Name, param.In))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
if param.Schema != nil {
// Validate example value against schema
- red := ex.validateExampleValueSchemaAgainstSchema(param.Name, param.In, param.Schema)
+ red := ex.validateExampleValueSchemaAgainstSchema(s.parameterPath(path, method, param.In, param.Name).structuralChild(jsonSchema), param.In, param.Schema)
if red.HasErrorsOrWarnings() {
- res.AddWarnings(exampleValueDoesNotValidateMsg(param.Name, param.In))
+ res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), exampleValueDoesNotValidateMsg(param.Name, param.In))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
}
@@ -118,68 +120,74 @@ func (ex *exampleValidator) validateExampleValueValidAgainstSchema() *Result {
if op.Responses != nil {
if op.Responses.Default != nil {
// Same constraint on default Response
- res.Merge(ex.validateExampleInResponse(op.Responses.Default, jsonDefault, path, 0, op.ID))
+ res.Merge(ex.validateExampleInResponse(op.Responses.Default, jsonDefault, path, method, 0, op.ID))
}
// Same constraint on regular Responses
if op.Responses.StatusCodeResponses != nil { // Safeguard
- for code, r := range op.Responses.StatusCodeResponses {
- res.Merge(ex.validateExampleInResponse(&r, "response", path, code, op.ID)) //#nosec
+ for _, code := range sortedKeys(op.Responses.StatusCodeResponses) {
+ r := op.Responses.StatusCodeResponses[code]
+ res.Merge(ex.validateExampleInResponse(&r, "response", path, method, code, op.ID))
}
}
} else if op.ID != "" {
// Empty op.ID means there is no meaningful operation: no need to report a specific message
- res.AddErrors(noValidResponseMsg(op.ID))
+ res.addErrorsAt(operationPath(path, method), noValidResponseMsg(op.ID))
}
}
}
if s.spec.Spec().Definitions != nil { // Safeguard
// reset explored schemas to get depth-first recursive-proof exploration
ex.resetVisited()
- for nm, sch := range s.spec.Spec().Definitions {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema("definitions."+nm, "body", &sch)) //#nosec
+ definitions := s.spec.Spec().Definitions
+ for _, nm := range sortedKeys(definitions) {
+ sch := definitions[nm]
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(newPathSegments(swaggerDefinitions, nm), "body", &sch))
}
}
return res
}
-func (ex *exampleValidator) validateExampleInResponse(resp *spec.Response, responseType, path string, responseCode int, operationID string) *Result {
+func (ex *exampleValidator) validateExampleInResponse(
+ resp *spec.Response, responseType, path, method string, responseCode int, operationID string,
+) *Result {
s := ex.SpecValidator
- response, res := responseHelp.expandResponseRef(resp, path, s)
+ responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode)
+ response, res := responseHelp.expandResponseRef(resp, path, responsePath(path, method, responseCodeAsStr), s)
if !res.IsValid() { // Safeguard
return res
}
- responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode)
-
if response.Headers != nil { // Safeguard
- for nm, h := range response.Headers {
+ for _, nm := range sortedKeys(response.Headers) {
+ h := response.Headers[nm]
// reset explored schemas to get depth-first recursive-proof exploration
ex.resetVisited()
if h.Example != nil {
red := newHeaderValidator(nm, &h, s.KnownFormats, ex.schemaOptions).Validate(h.Example) //#nosec
+ red.relocate(responseHeaderPath(path, method, responseCodeAsStr, nm).child(swaggerExample))
if red.HasErrorsOrWarnings() {
- res.AddWarnings(exampleValueHeaderDoesNotValidateMsg(operationID, nm, responseName))
+ res.addWarningsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), exampleValueHeaderDoesNotValidateMsg(operationID, nm, responseName))
res.MergeAsWarnings(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
// Headers have inline definition, like params
if h.Items != nil {
- red := ex.validateExampleValueItemsAgainstSchema(nm, "header", &h, h.Items) //#nosec
+ red := ex.validateExampleValueItemsAgainstSchema(responseHeaderPath(path, method, responseCodeAsStr, nm), "header", &h, h.Items) //#nosec
if red.HasErrorsOrWarnings() {
- res.AddWarnings(exampleValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName))
+ res.addWarningsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), exampleValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName))
res.MergeAsWarnings(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
if _, err := compileRegexp(h.Pattern); err != nil {
- res.AddErrors(invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err))
+ res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err))
}
// Headers don't have schema
@@ -189,77 +197,84 @@ func (ex *exampleValidator) validateExampleInResponse(resp *spec.Response, respo
// reset explored schemas to get depth-first recursive-proof exploration
ex.resetVisited()
- red := ex.validateExampleValueSchemaAgainstSchema(responseCodeAsStr, "response", response.Schema)
+ red := ex.validateExampleValueSchemaAgainstSchema(
+ responsePath(path, method, responseCodeAsStr).structuralChild(jsonSchema), "response", response.Schema)
if red.HasErrorsOrWarnings() {
// Additional message to make sure the context of the error is not lost
- res.AddWarnings(exampleValueInDoesNotValidateMsg(operationID, responseName))
+ res.addWarningsAt(responsePath(path, method, responseCodeAsStr), exampleValueInDoesNotValidateMsg(operationID, responseName))
res.Merge(red)
} else if red.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(red)
+ redeemResult(red)
}
}
if response.Examples != nil {
if response.Schema != nil {
- if example, ok := response.Examples["application/json"]; ok {
+ if example, ok := response.Examples[jsonMimeApplicationJSON]; ok {
+ exampleAt := responsePath(path, method, responseCodeAsStr).
+ child(swaggerExamples).
+ structuralChild(jsonMimeApplicationJSON)
res.MergeAsWarnings(
- newSchemaValidator(response.Schema, s.spec.Spec(), path+".examples", s.KnownFormats, s.schemaOptions).Validate(example),
+ newSchemaValidator(response.Schema, s.spec.Spec(),
+ exampleAt, s.KnownFormats, s.schemaOptions).Validate(example),
)
} else {
// Proposal for enhancement: validate other media types too
- res.AddWarnings(examplesMimeNotSupportedMsg(operationID, responseName))
+ res.addWarningsAt(responsePath(path, method, responseCodeAsStr).child(swaggerExamples), examplesMimeNotSupportedMsg(operationID, responseName))
}
} else {
- res.AddWarnings(examplesWithoutSchemaMsg(operationID, responseName))
+ res.addWarningsAt(responsePath(path, method, responseCodeAsStr).child(swaggerExamples), examplesWithoutSchemaMsg(operationID, responseName))
}
}
return res
}
-func (ex *exampleValidator) validateExampleValueSchemaAgainstSchema(path, in string, schema *spec.Schema) *Result {
+func (ex *exampleValidator) validateExampleValueSchemaAgainstSchema(path pathSegments, in string, schema *spec.Schema) *Result {
if schema == nil || ex.isVisited(path) {
// Avoids recursing if we are already done with that check
return nil
}
ex.beingVisited(path)
s := ex.SpecValidator
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
if schema.Example != nil {
res.MergeAsWarnings(
- newSchemaValidator(schema, s.spec.Spec(), path+".example", s.KnownFormats, ex.schemaOptions).Validate(schema.Example),
+ newSchemaValidator(schema, s.spec.Spec(), path.child(swaggerExample), s.KnownFormats, ex.schemaOptions).Validate(schema.Example),
)
}
if schema.Items != nil {
if schema.Items.Schema != nil {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+".items.example", in, schema.Items.Schema))
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonItems), in, schema.Items.Schema))
}
// Multiple schemas in items
if schema.Items.Schemas != nil { // Safeguard
for i, sch := range schema.Items.Schemas {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(fmt.Sprintf("%s.items[%d].example", path, i), in, &sch)) //#nosec
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonItems).item(i), in, &sch)) //#nosec
}
}
}
if _, err := compileRegexp(schema.Pattern); err != nil {
- res.AddErrors(invalidPatternInMsg(path, in, schema.Pattern))
+ res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, schema.Pattern))
}
if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil {
// NOTE: we keep validating values, even though additionalItems is unsupported in Swagger 2.0 (and 3.0 as well)
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+".additionalItems", in, schema.AdditionalItems.Schema))
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonAdditionalItems), in, schema.AdditionalItems.Schema))
}
- for propName, prop := range schema.Properties {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec
+ for _, propName := range sortedKeys(schema.Properties) {
+ prop := schema.Properties[propName]
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.structuralChild(jsonProperties).child(propName), in, &prop))
}
- for propName, prop := range schema.PatternProperties {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec
+ for _, propName := range sortedKeys(schema.PatternProperties) {
+ prop := schema.PatternProperties[propName]
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.structuralChild(jsonPatternProperties).child(propName), in, &prop))
}
if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+".additionalProperties", in, schema.AdditionalProperties.Schema))
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonAdditionalProperties), in, schema.AdditionalProperties.Schema))
}
if schema.AllOf != nil {
for i, aoSch := range schema.AllOf {
- res.Merge(ex.validateExampleValueSchemaAgainstSchema(fmt.Sprintf("%s.allOf[%d]", path, i), in, &aoSch)) //#nosec
+ res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonAllOf).item(i), in, &aoSch)) //#nosec
}
}
return res
@@ -268,8 +283,8 @@ func (ex *exampleValidator) validateExampleValueSchemaAgainstSchema(path, in str
// NOTE: Temporary duplicated code. Need to refactor with examples
//
-func (ex *exampleValidator) validateExampleValueItemsAgainstSchema(path, in string, root any, items *spec.Items) *Result {
- res := pools.poolOfResults.BorrowResult()
+func (ex *exampleValidator) validateExampleValueItemsAgainstSchema(path pathSegments, in string, root any, items *spec.Items) *Result {
+ res := validatorPools.results.Borrow()
s := ex.SpecValidator
if items != nil {
if items.Example != nil {
@@ -278,10 +293,10 @@ func (ex *exampleValidator) validateExampleValueItemsAgainstSchema(path, in stri
)
}
if items.Items != nil {
- res.Merge(ex.validateExampleValueItemsAgainstSchema(path+"[0].example", in, root, items.Items))
+ res.Merge(ex.validateExampleValueItemsAgainstSchema(path.item(0), in, root, items.Items))
}
if _, err := compileRegexp(items.Pattern); err != nil {
- res.AddErrors(invalidPatternInMsg(path, in, items.Pattern))
+ res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, items.Pattern))
}
}
diff --git a/vendor/github.com/go-openapi/validate/formats.go b/vendor/github.com/go-openapi/validate/formats.go
index eab2615376..23359e35dd 100644
--- a/vendor/github.com/go-openapi/validate/formats.go
+++ b/vendor/github.com/go-openapi/validate/formats.go
@@ -11,21 +11,21 @@ import (
)
type formatValidator struct {
- Path string
+ Path pathSegments
In string
Format string
KnownFormats strfmt.Registry
Options *SchemaValidatorOptions
}
-func newFormatValidator(path, in, format string, formats strfmt.Registry, opts *SchemaValidatorOptions) *formatValidator {
+func newFormatValidator(path pathSegments, in, format string, formats strfmt.Registry, opts *SchemaValidatorOptions) *formatValidator {
if opts == nil {
opts = new(SchemaValidatorOptions)
}
var f *formatValidator
if opts.recycleValidators {
- f = pools.poolOfFormatValidators.BorrowValidator()
+ f = validatorPools.formatValidators.Borrow()
} else {
f = new(formatValidator)
}
@@ -39,10 +39,6 @@ func newFormatValidator(path, in, format string, formats strfmt.Registry, opts *
return f
}
-func (f *formatValidator) SetPath(path string) {
- f.Path = path
-}
-
func (f *formatValidator) Applies(source any, kind reflect.Kind) bool {
if source == nil || f.KnownFormats == nil {
return false
@@ -71,7 +67,7 @@ func (f *formatValidator) Validate(val any) *Result {
var result *Result
if f.Options.recycleResult {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
} else {
result = new(Result)
}
@@ -81,13 +77,17 @@ func (f *formatValidator) Validate(val any) *Result {
return result
}
- if err := FormatOf(f.Path, f.In, f.Format, str, f.KnownFormats); err != nil {
- result.AddErrors(err)
+ if err := FormatOf(f.Path.dotted(), f.In, f.Format, str, f.KnownFormats); err != nil {
+ result.addErrorsAt(f.Path, err)
}
return result
}
+func (f *formatValidator) setPath(path pathSegments) {
+ f.Path = path
+}
+
func (f *formatValidator) redeem() {
- pools.poolOfFormatValidators.RedeemValidator(f)
+ validatorPools.formatValidators.Redeem(f)
}
diff --git a/vendor/github.com/go-openapi/validate/helpers.go b/vendor/github.com/go-openapi/validate/helpers.go
index 8a1a231283..62deb97d0e 100644
--- a/vendor/github.com/go-openapi/validate/helpers.go
+++ b/vendor/github.com/go-openapi/validate/helpers.go
@@ -12,6 +12,7 @@ import (
"strings"
"github.com/go-openapi/errors"
+ "github.com/go-openapi/jsonpointer"
"github.com/go-openapi/spec"
)
@@ -33,13 +34,78 @@ const (
)
const (
- jsonProperties = "properties"
- jsonItems = "items"
- jsonType = "type"
- // jsonSchema = "schema".
- jsonDefault = "default"
+ jsonProperties = "properties"
+ jsonPatternProperties = "patternProperties"
+ jsonItems = "items"
+ jsonType = "type"
+ jsonSchema = "schema"
+ jsonRequired = "required"
+ jsonRef = "$ref"
+ jsonDefault = "default"
+
+ jsonAllOf = "allOf"
+ jsonAnyOf = "anyOf"
+ jsonOneOf = "oneOf"
+ jsonNot = "not"
+ jsonAdditionalItems = "additionalItems"
+ jsonAdditionalProperties = "additionalProperties"
+
+ swaggerPaths = "paths"
+ swaggerDefinitions = "definitions"
+ swaggerResponses = "responses"
+ swaggerParameters = "parameters"
+ swaggerHeaders = "headers"
+ swaggerOperationID = "operationId"
+
+ jsonMimeApplicationJSON = "application/json"
)
+// operationPath locates an operation in the spec document.
+func operationPath(path, method string) pathSegments {
+ return newPathSegments(swaggerPaths, path, methodToken(method))
+}
+
+// parameterPath locates a parameter of an operation in the spec document.
+func (s *SpecValidator) parameterPath(path, method, in, name string) pathSegments {
+ return s.paramLocations.at(path, method, in, name)
+}
+
+// responsePath locates a response of an operation in the spec document.
+func responsePath(path, method, responseCode string) pathSegments {
+ return operationPath(path, method).children(swaggerResponses, responseCode)
+}
+
+// responseHeaderPath locates a header declared by a response.
+func responseHeaderPath(path, method, responseCode, header string) pathSegments {
+ return responsePath(path, method, responseCode).children(swaggerHeaders, header)
+}
+
+// methodToken normalizes an HTTP method into the key under which the operation
+// is found in the document: the analyzer hands them over in upper case, but a
+// path item spells them in lower case.
+func methodToken(method string) string {
+ return strings.ToLower(method)
+}
+
+// localRefPath turns a local JSON reference such as "#/definitions/Pet" into
+// the location of what it points to.
+//
+// It yields the document root for anything that does not address a local
+// fragment, a remote reference in particular.
+func localRefPath(ref string) pathSegments {
+ rest, isLocal := strings.CutPrefix(ref, "#/")
+ if !isLocal {
+ return rootPath()
+ }
+
+ tokens := strings.Split(rest, "/")
+ for i, token := range tokens {
+ tokens[i] = jsonpointer.Unescape(token)
+ }
+
+ return newPathSegments(tokens...)
+}
+
const (
stringFormatDate = "date"
stringFormatDateTime = "date-time"
@@ -91,24 +157,33 @@ type errorHelper struct {
}
func (h *errorHelper) sErr(err errors.Error, recycle bool) *Result {
- // Builds a Result from standard errors.Error
+ return h.sErrAt(nil, err, recycle)
+}
+
+// sErrAt builds a Result from a standard errors.Error reported at a known location.
+func (h *errorHelper) sErrAt(at pathSegments, err errors.Error, recycle bool) *Result {
var result *Result
if recycle {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
} else {
result = new(Result)
}
- result.Errors = []error{err}
+ result.addErrorsAt(at, err)
return result
}
func (h *errorHelper) addPointerError(res *Result, err error, ref string, fromPath string) *Result {
- // Provides more context on error messages
- // reported by the jsoinpointer package by altering the passed Result
+ return h.addPointerErrorAt(res, nil, err, ref, fromPath)
+}
+
+// addPointerErrorAt provides more context on error messages reported by the
+// jsonpointer package, by altering the passed Result.
+func (h *errorHelper) addPointerErrorAt(res *Result, at pathSegments, err error, ref string, fromPath string) *Result {
if err != nil {
- res.AddErrors(cannotResolveRefMsg(fromPath, ref, err))
+ res.addErrorsAt(at, cannotResolveRefMsg(fromPath, ref, err))
}
+
return res
}
@@ -222,15 +297,19 @@ func (h *paramHelper) safeExpandedParamsFor(path, method, operationID string, re
// remove params with invalid expansion from Slice
operation.Parameters = resolvedParams
- for _, ppr := range s.expandedAnalyzer().SafeParamsFor(method, path,
+ // the analyzer keys parameters by name and location: walk those keys in
+ // order, so that findings about an operation's parameters come out the
+ // same way on every run
+ safeParams := s.expandedAnalyzer().SafeParamsFor(method, path,
func(_ spec.Parameter, err error) bool {
// since params have already been expanded, there are few causes for error
- res.AddErrors(someParametersBrokenMsg(path, method, operationID))
+ res.addErrorsAt(operationPath(path, method), someParametersBrokenMsg(path, method, operationID))
// original error from analyzer
- res.AddErrors(err)
+ res.addErrorsAt(operationPath(path, method), err)
return true
- }) {
- params = append(params, ppr)
+ })
+ for _, k := range sortedKeys(safeParams) {
+ params = append(params, safeParams[k])
}
}
return
@@ -242,21 +321,23 @@ func (h *paramHelper) resolveParam(path, method, operationID string, param *spec
res := new(Result)
isRef := param.Ref.String() != ""
if s.spec.SpecFilePath() == "" {
- err = spec.ExpandParameterWithRoot(param, s.spec.Spec(), nil)
+ err = spec.ExpandParameterWithOptions(param, s.spec.Spec(), nil, s.schemaOptions.expandOptions(""))
} else {
- err = spec.ExpandParameter(param, s.spec.SpecFilePath())
+ err = spec.ExpandParameterWithOptions(param, nil, nil, s.schemaOptions.expandOptions(s.spec.SpecFilePath()))
}
if err != nil { // Safeguard
// NOTE: we may enter here when the whole parameter is an unresolved $ref
refPath := strings.Join([]string{"\"" + path + "\"", method}, ".")
- errorHelp.addPointerError(res, err, param.Ref.String(), refPath)
+ errorHelp.addPointerErrorAt(res, s.parameterPath(path, method, param.In, param.Name), err, param.Ref.String(), refPath)
return nil, res
}
- res.Merge(h.checkExpandedParam(param, param.Name, param.In, operationID, isRef))
+ res.Merge(h.checkExpandedParam(param, param.Name, param.In, operationID, s.parameterPath(path, method, param.In, param.Name), isRef))
return param, res
}
-func (h *paramHelper) checkExpandedParam(pr *spec.Parameter, path, in, operation string, isRef bool) *Result {
+func (h *paramHelper) checkExpandedParam(
+ pr *spec.Parameter, path, in, operation string, at pathSegments, isRef bool,
+) *Result {
// Secure parameter structure after $ref resolution
res := new(Result)
simpleZero := spec.SimpleSchema{}
@@ -267,17 +348,17 @@ func (h *paramHelper) checkExpandedParam(pr *spec.Parameter, path, in, operation
// Most likely, a $ref with a sibling is an unwanted situation: in itself this is a warning...
// but we detect it because of the following error:
// schema took over Parameter for an unexplained reason
- res.AddWarnings(refShouldNotHaveSiblingsMsg(path, operation))
+ res.addWarningsAt(at, refShouldNotHaveSiblingsMsg(path, operation))
}
- res.AddErrors(invalidParameterDefinitionMsg(path, in, operation))
+ res.addErrorsAt(at, invalidParameterDefinitionMsg(path, in, operation))
case pr.In != swaggerBody && pr.Schema != nil:
if isRef {
- res.AddWarnings(refShouldNotHaveSiblingsMsg(path, operation))
+ res.addWarningsAt(at, refShouldNotHaveSiblingsMsg(path, operation))
}
- res.AddErrors(invalidParameterDefinitionAsSchemaMsg(path, in, operation))
+ res.addErrorsAt(at, invalidParameterDefinitionAsSchemaMsg(path, in, operation))
case (pr.In == swaggerBody && pr.Schema == nil) || (pr.In != swaggerBody && pr.SimpleSchema == simpleZero):
// Other unexpected mishaps
- res.AddErrors(invalidParameterDefinitionMsg(path, in, operation))
+ res.addErrorsAt(at, invalidParameterDefinitionMsg(path, in, operation))
}
return res
}
@@ -288,20 +369,20 @@ type responseHelper struct {
func (r *responseHelper) expandResponseRef(
response *spec.Response,
- path string, s *SpecValidator,
+ path string, at pathSegments, s *SpecValidator,
) (*spec.Response, *Result) {
// Ensure response is expanded
var err error
res := new(Result)
if s.spec.SpecFilePath() == "" {
// there is no physical document to resolve $ref in response
- err = spec.ExpandResponseWithRoot(response, s.spec.Spec(), nil)
+ err = spec.ExpandResponseWithOptions(response, s.spec.Spec(), nil, s.schemaOptions.expandOptions(""))
} else {
- err = spec.ExpandResponse(response, s.spec.SpecFilePath())
+ err = spec.ExpandResponseWithOptions(response, nil, nil, s.schemaOptions.expandOptions(s.spec.SpecFilePath()))
}
if err != nil { // Safeguard
// NOTE: we may enter here when the whole response is an unresolved $ref.
- errorHelp.addPointerError(res, err, response.Ref.String(), path)
+ errorHelp.addPointerErrorAt(res, at, err, response.Ref.String(), path)
return nil, res
}
diff --git a/vendor/github.com/go-openapi/validate/object_validator.go b/vendor/github.com/go-openapi/validate/object_validator.go
index e651b3f70f..4f1dd15a29 100644
--- a/vendor/github.com/go-openapi/validate/object_validator.go
+++ b/vendor/github.com/go-openapi/validate/object_validator.go
@@ -4,7 +4,6 @@
package validate
import (
- "fmt"
"reflect"
"strings"
@@ -14,7 +13,7 @@ import (
)
type objectValidator struct {
- Path string
+ Path pathSegments
In string
MaxProperties *int64
MinProperties *int64
@@ -25,10 +24,9 @@ type objectValidator struct {
Root any
KnownFormats strfmt.Registry
Options *SchemaValidatorOptions
- splitPath []string
}
-func newObjectValidator(path, in string,
+func newObjectValidator(path pathSegments, in string,
maxProperties, minProperties *int64, required []string, properties spec.SchemaProperties,
additionalProperties *spec.SchemaOrBool, patternProperties spec.SchemaProperties,
root any, formats strfmt.Registry, opts *SchemaValidatorOptions,
@@ -39,7 +37,7 @@ func newObjectValidator(path, in string,
var v *objectValidator
if opts.recycleValidators {
- v = pools.poolOfObjectValidators.BorrowValidator()
+ v = validatorPools.objectValidators.Borrow()
} else {
v = new(objectValidator)
}
@@ -55,7 +53,6 @@ func newObjectValidator(path, in string,
v.Root = root
v.KnownFormats = formats
v.Options = opts
- v.splitPath = strings.Split(v.Path, ".")
return v
}
@@ -72,21 +69,21 @@ func (o *objectValidator) Validate(data any) *Result {
var ok bool
val, ok = data.(map[string]any)
if !ok {
- return errorHelp.sErr(invalidObjectMsg(o.Path, o.In), o.Options.recycleResult)
+ return errorHelp.sErrAt(o.Path, invalidObjectMsg(o.Path.dotted(), o.In), o.Options.recycleResult)
}
}
numKeys := int64(len(val))
if o.MinProperties != nil && numKeys < *o.MinProperties {
- return errorHelp.sErr(errors.TooFewProperties(o.Path, o.In, *o.MinProperties), o.Options.recycleResult)
+ return errorHelp.sErrAt(o.Path, errors.TooFewProperties(o.Path.dotted(), o.In, *o.MinProperties), o.Options.recycleResult)
}
if o.MaxProperties != nil && numKeys > *o.MaxProperties {
- return errorHelp.sErr(errors.TooManyProperties(o.Path, o.In, *o.MaxProperties), o.Options.recycleResult)
+ return errorHelp.sErrAt(o.Path, errors.TooManyProperties(o.Path.dotted(), o.In, *o.MaxProperties), o.Options.recycleResult)
}
var res *Result
if o.Options.recycleResult {
- res = pools.poolOfResults.BorrowResult()
+ res = validatorPools.results.Borrow()
} else {
res = new(Result)
}
@@ -106,7 +103,8 @@ func (o *objectValidator) Validate(data any) *Result {
// Check patternProperties
// NOTE: it looks like we have done that twice in many cases
- for key, value := range val {
+ for _, key := range sortedKeys(val) {
+ value := val[key]
_, regularProperty := o.Properties[key]
matched, _, patterns := o.validatePatternProperty(key, value, res) // applies to regular properties as well
if regularProperty || !matched {
@@ -115,7 +113,7 @@ func (o *objectValidator) Validate(data any) *Result {
for _, pName := range patterns {
if v, ok := o.PatternProperties[pName]; ok {
- r := newSchemaValidator(&v, o.Root, o.Path+"."+key, o.KnownFormats, o.Options).Validate(value)
+ r := newSchemaValidator(&v, o.Root, o.Path.child(key), o.KnownFormats, o.Options).Validate(value)
res.mergeForField(data.(map[string]any), key, r) //nolint:forcetypeassert // data is always map[string]any at this point
}
}
@@ -124,11 +122,6 @@ func (o *objectValidator) Validate(data any) *Result {
return res
}
-func (o *objectValidator) SetPath(path string) {
- o.Path = path
- o.splitPath = strings.Split(path, ".")
-}
-
func (o *objectValidator) Applies(source any, kind reflect.Kind) bool {
// NOTE: this should also work for structs
// there is a problem in the type validator where it will be unhappy about null values
@@ -137,19 +130,29 @@ func (o *objectValidator) Applies(source any, kind reflect.Kind) bool {
return isSchema && (kind == reflect.Map || kind == reflect.Struct)
}
+// The three predicates below tell what kind of content the validated object
+// is, so that schema-only checks are not run against plain data.
+//
+// Array indices are trimmed first: an element of an example is example data
+// just as much as the example itself.
+
func (o *objectValidator) isProperties() bool {
- p := o.splitPath
- return len(p) > 1 && p[len(p)-1] == jsonProperties && p[len(p)-2] != jsonProperties
+ p := o.Path.trimIndexes()
+
+ return p.last() == jsonProperties && p.beforeLast() != jsonProperties
}
func (o *objectValidator) isDefault() bool {
- p := o.splitPath
- return len(p) > 1 && p[len(p)-1] == jsonDefault && p[len(p)-2] != jsonDefault
+ p := o.Path.trimIndexes()
+
+ return p.last() == jsonDefault && p.beforeLast() != jsonDefault
}
func (o *objectValidator) isExample() bool {
- p := o.splitPath
- return len(p) > 1 && (p[len(p)-1] == swaggerExample || p[len(p)-1] == swaggerExamples) && p[len(p)-2] != swaggerExample
+ p := o.Path.trimIndexes()
+ last := p.last()
+
+ return (last == swaggerExample || last == swaggerExamples) && p.beforeLast() != swaggerExample
}
func (o *objectValidator) checkArrayMustHaveItems(res *Result, val map[string]any) {
@@ -174,7 +177,7 @@ func (o *objectValidator) checkArrayMustHaveItems(res *Result, val map[string]an
return
}
- res.AddErrors(errors.Required(jsonItems, o.Path, item))
+ res.addErrorsAt(o.Path, errors.Required(jsonItems, o.Path.dotted(), item))
}
func (o *objectValidator) checkItemsMustBeTypeArray(res *Result, val map[string]any) {
@@ -194,11 +197,11 @@ func (o *objectValidator) checkItemsMustBeTypeArray(res *Result, val map[string]
t, typeFound := val[jsonType]
if !typeFound {
// there is no type
- res.AddErrors(errors.Required(jsonType, o.Path, t))
+ res.addErrorsAt(o.Path, errors.Required(jsonType, o.Path.dotted(), t))
}
if tpe, isString := t.(string); !isString || tpe != arrayType {
- res.AddErrors(errors.InvalidType(o.Path, o.In, arrayType, nil))
+ res.addErrorsAt(o.Path, errors.InvalidType(o.Path.dotted(), o.In, arrayType, nil))
}
}
@@ -212,7 +215,7 @@ func (o *objectValidator) precheck(res *Result, val map[string]any) {
}
func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res *Result) {
- for k := range val {
+ for _, k := range sortedKeys(val) {
if k == "$schema" || k == "id" {
// special properties "$schema" and "id" are ignored
continue
@@ -238,7 +241,7 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res
continue
}
- res.AddErrors(errors.PropertyNotAllowed(o.Path, o.In, k))
+ res.addErrorsAt(o.Path.child(k), errors.PropertyNotAllowed(o.Path.dotted(), o.In, k))
// BUG(fredbi): This section should move to a part dedicated to spec validation as
// it will conflict with regular schemas where a property "headers" is defined.
@@ -261,7 +264,8 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res
continue
}
- for headerKey, headerBody := range headers {
+ for _, headerKey := range sortedKeys(headers) {
+ headerBody := headers[headerKey]
if headerBody == nil {
continue
}
@@ -282,7 +286,7 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res
}
msg := strings.Join([]string{", one may not use $ref=\":", refString, "\""}, "")
- res.AddErrors(refNotAllowedInHeaderMsg(o.Path, headerKey, msg))
+ res.addErrorsAt(o.Path, refNotAllowedInHeaderMsg(o.Path.dotted(), headerKey, msg))
/*
case "$ref":
if val[k] != nil {
@@ -294,7 +298,8 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res
}
func (o *objectValidator) validateAdditionalProperties(val map[string]any, res *Result) {
- for key, value := range val {
+ for _, key := range sortedKeys(val) {
+ value := val[key]
_, regularProperty := o.Properties[key]
if regularProperty {
continue
@@ -315,7 +320,7 @@ func (o *objectValidator) validateAdditionalProperties(val map[string]any, res *
// Cases: properties which are not regular properties and have not been matched by the PatternProperties validator
// AdditionalProperties as Schema
- r := newSchemaValidator(o.AdditionalProperties.Schema, o.Root, o.Path+"."+key, o.KnownFormats, o.Options).Validate(value)
+ r := newSchemaValidator(o.AdditionalProperties.Schema, o.Root, o.Path.child(key), o.KnownFormats, o.Options).Validate(value)
res.mergeForField(val, key, r)
}
// Valid cases: additionalProperties: true or undefined
@@ -326,19 +331,14 @@ func (o *objectValidator) validatePropertiesSchema(val map[string]any, res *Resu
// Property types:
// - regular Property
- pSchema := pools.poolOfSchemas.BorrowSchema() // recycle a spec.Schema object which lifespan extends only to the validation of properties
+ pSchema := validatorPools.schemas.Borrow() // recycle a spec.Schema object which lifespan extends only to the validation of properties
defer func() {
- pools.poolOfSchemas.RedeemSchema(pSchema)
+ validatorPools.schemas.Redeem(pSchema)
}()
- for pName := range o.Properties {
+ for _, pName := range sortedKeys(o.Properties) {
*pSchema = o.Properties[pName]
- var rName string
- if o.Path == "" {
- rName = pName
- } else {
- rName = o.Path + "." + pName
- }
+ rName := o.Path.child(pName)
// Recursively validates each property against its schema
v, ok := val[pName]
@@ -374,7 +374,9 @@ func (o *objectValidator) validatePropertiesSchema(val map[string]any, res *Resu
continue
}
- res.AddErrors(errors.Required(fmt.Sprintf("%s.%s", o.Path, k), o.In, v))
+ // located on the object that lacks the property: the property itself
+ // has no node to point at, and the object is what has to be amended
+ res.addErrorsAt(o.Path, errors.Required(o.Path.child(k).dotted(), o.In, v))
}
}
@@ -388,12 +390,12 @@ func (o *objectValidator) validatePatternProperty(key string, value any, result
succeededOnce := false
patterns := make([]string, 0, len(o.PatternProperties))
- schema := pools.poolOfSchemas.BorrowSchema()
+ schema := validatorPools.schemas.Borrow()
defer func() {
- pools.poolOfSchemas.RedeemSchema(schema)
+ validatorPools.schemas.Redeem(schema)
}()
- for k := range o.PatternProperties {
+ for _, k := range sortedKeys(o.PatternProperties) {
re, err := compileRegexp(k)
if err != nil {
continue
@@ -407,7 +409,7 @@ func (o *objectValidator) validatePatternProperty(key string, value any, result
*schema = o.PatternProperties[k]
patterns = append(patterns, k)
matched = true
- validator := newSchemaValidator(schema, o.Root, fmt.Sprintf("%s.%s", o.Path, key), o.KnownFormats, o.Options)
+ validator := newSchemaValidator(schema, o.Root, o.Path.child(key), o.KnownFormats, o.Options)
res := validator.Validate(value)
result.Merge(res)
@@ -416,6 +418,10 @@ func (o *objectValidator) validatePatternProperty(key string, value any, result
return matched, succeededOnce, patterns
}
+func (o *objectValidator) setPath(path pathSegments) {
+ o.Path = path
+}
+
func (o *objectValidator) redeem() {
- pools.poolOfObjectValidators.RedeemValidator(o)
+ validatorPools.objectValidators.Redeem(o)
}
diff --git a/vendor/github.com/go-openapi/validate/param_locations.go b/vendor/github.com/go-openapi/validate/param_locations.go
new file mode 100644
index 0000000000..703d6ca17f
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/param_locations.go
@@ -0,0 +1,122 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "strconv"
+
+ "github.com/go-openapi/spec"
+)
+
+// paramLocations tells where an operation declares a parameter.
+//
+// Parameters are held in an array, so a name is not how a document addresses
+// one: only its index is. The index is not something a validator can work out
+// from an expanded parameter either, because expansion merges the parameters
+// an operation declares with those its path item declares, and resolves the
+// ones written as a $ref. So the unexpanded document is indexed once, and
+// looked up by what a validator does know: the operation, and the name and
+// location of the parameter it is reporting on.
+type paramLocations map[paramKey]pathSegments
+
+// paramKey identifies a parameter the way the swagger specification does:
+// a name is unique only within an "in".
+type paramKey struct {
+ path string
+ method string
+ in string
+ name string
+}
+
+// newParamLocations indexes the parameters declared by an unexpanded document.
+func newParamLocations(sp *spec.Swagger) paramLocations {
+ locations := make(paramLocations)
+ if sp == nil || sp.Paths == nil {
+ return locations
+ }
+
+ for path, pathItem := range sp.Paths.Paths {
+ at := newPathSegments(swaggerPaths, path)
+
+ // parameters declared by the path item are shared by all its
+ // operations: recorded once, without a method
+ locations.collect(sp, paramKey{path: path}, at, pathItem.Parameters)
+
+ for method, op := range operationsOf(&pathItem) { //#nosec
+ if op == nil {
+ continue
+ }
+
+ locations.collect(sp, paramKey{path: path, method: method}, at.child(method), op.Parameters)
+ }
+ }
+
+ return locations
+}
+
+// at returns where an operation declares a parameter.
+//
+// A parameter the operation does not declare itself may come from its path
+// item. When neither knows it, which happens for a parameter too broken to be
+// identified, the pointer stops on the array holding it and the name is kept
+// for the message alone: an index no one could work out would be a guess.
+func (l paramLocations) at(path, method, in, name string) pathSegments {
+ if found, isDeclared := l[paramKey{path: path, method: methodToken(method), in: in, name: name}]; isDeclared {
+ return found
+ }
+
+ if found, isDeclared := l[paramKey{path: path, in: in, name: name}]; isDeclared {
+ return found
+ }
+
+ return operationPath(path, method).child(swaggerParameters).cosmeticChild(name)
+}
+
+func (l paramLocations) collect(sp *spec.Swagger, key paramKey, at pathSegments, params []spec.Parameter) {
+ for i := range params {
+ name, in, ok := parameterIdentity(sp, ¶ms[i])
+ if !ok {
+ continue
+ }
+
+ key.name = name
+ key.in = in
+ l[key] = at.child(swaggerParameters).childAs(strconv.Itoa(i), name)
+ }
+}
+
+// parameterIdentity names a parameter as declared, resolving the one indirection
+// a document may put in the way: an entry written as a local $ref.
+func parameterIdentity(sp *spec.Swagger, param *spec.Parameter) (name, in string, ok bool) {
+ if param.Ref.String() == "" {
+ return param.Name, param.In, param.Name != ""
+ }
+
+ shared := localRefPath(param.Ref.String())
+ const sharedParameterDepth = 2
+ if len(shared) != sharedParameterDepth || shared.beforeLast() != swaggerParameters {
+ return "", "", false
+ }
+
+ declared, isDeclared := sp.Parameters[shared.last()]
+ if !isDeclared {
+ return "", "", false
+ }
+
+ return declared.Name, declared.In, declared.Name != ""
+}
+
+// operationsOf yields the operations of a path item, keyed as the document
+// spells them.
+func operationsOf(pathItem *spec.PathItem) map[string]*spec.Operation {
+ return map[string]*spec.Operation{
+ "get": pathItem.Get,
+ "put": pathItem.Put,
+ "post": pathItem.Post,
+ "delete": pathItem.Delete,
+ "options": pathItem.Options,
+ "head": pathItem.Head,
+ "patch": pathItem.Patch,
+ }
+}
diff --git a/vendor/github.com/go-openapi/validate/path.go b/vendor/github.com/go-openapi/validate/path.go
new file mode 100644
index 0000000000..940fc4be55
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/path.go
@@ -0,0 +1,269 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "slices"
+ "strconv"
+ "strings"
+
+ "github.com/go-openapi/jsonpointer"
+)
+
+// pathSegments is the location of a validated value inside a document,
+// held as an ordered list of unescaped JSON pointer reference tokens.
+//
+// Validators build a location by appending tokens as they descend into
+// properties and array items, then render it only when they report an error.
+// Keeping the tokens apart until then is what makes it possible to produce a
+// valid [RFC 6901] JSON pointer: a token is escaped when it is rendered, and
+// the separator can never be confused with a token that contains one.
+//
+// The zero value is the location of the document root.
+//
+// [RFC 6901]: https://datatracker.ietf.org/doc/html/rfc6901
+type pathSegments []pathToken
+
+// pathToken is one step of a location.
+//
+// A token addresses a member the way the document does, which is not always
+// the way a reader recognizes it: an operation addresses its parameters by
+// index, while a message is far more useful naming them. When the two differ,
+// display carries the readable form and only the message uses it.
+type pathToken struct {
+ token string
+ display string
+
+ // structural marks a token a document needs to address the value, but
+ // that messages have never shown: a "properties" between a schema and one
+ // of its members, say. It is part of the pointer and absent from the
+ // dotted form.
+ structural bool
+
+ // cosmetic is the converse: a token messages name but that the document
+ // does not address, such as a parameter too broken to be found by name in
+ // the array holding it. It is part of the dotted form and absent from the
+ // pointer, which then stops at the deepest node the document does contain.
+ cosmetic bool
+}
+
+// readable renders a token the way a message should spell it.
+func (t pathToken) readable() string {
+ if t.display != "" {
+ return t.display
+ }
+
+ return t.token
+}
+
+// newPathSegments builds a location from a list of unescaped tokens.
+func newPathSegments(tokens ...string) pathSegments {
+ if len(tokens) == 0 {
+ return nil
+ }
+
+ segments := make(pathSegments, len(tokens))
+ for i, token := range tokens {
+ segments[i] = pathToken{token: token}
+ }
+
+ return segments
+}
+
+// rootPath is the location of the document root.
+func rootPath() pathSegments { return nil }
+
+// String implements [fmt.Stringer] with the legacy dotted notation, so that a
+// location interpolated into a message reads as it always has.
+func (p pathSegments) String() string { return p.dotted() }
+
+// child returns the location of a named member of the value at p.
+//
+// The receiver is never modified: sibling children may be derived from the
+// same parent without aliasing one another.
+func (p pathSegments) child(token string) pathSegments {
+ return p.appendToken(pathToken{token: token})
+}
+
+// childAs returns the location of a member the document addresses as token,
+// which messages should spell as display instead.
+func (p pathSegments) childAs(token, display string) pathSegments {
+ return p.appendToken(pathToken{token: token, display: display})
+}
+
+// structuralChild returns the location of a member a document addresses but
+// messages do not name.
+func (p pathSegments) structuralChild(token string) pathSegments {
+ return p.appendToken(pathToken{token: token, structural: true})
+}
+
+// cosmeticChild returns a location that messages spell as a member named token,
+// while the pointer stays on p.
+func (p pathSegments) cosmeticChild(token string) pathSegments {
+ return p.appendToken(pathToken{token: token, cosmetic: true})
+}
+
+func (p pathSegments) appendToken(token pathToken) pathSegments {
+ child := make(pathSegments, len(p)+1)
+ copy(child, p)
+ child[len(p)] = p.inherit(token)
+
+ return child
+}
+
+// inherit passes down what a parent token says about addressability: nothing
+// below a token the document does not address is addressable either, so the
+// pointer has to stop at the same place.
+func (p pathSegments) inherit(token pathToken) pathToken {
+ if len(p) > 0 && p[len(p)-1].cosmetic {
+ token.cosmetic = true
+ }
+
+ return token
+}
+
+// children returns the location of a chain of named members below p.
+func (p pathSegments) children(tokens ...string) pathSegments {
+ child := make(pathSegments, len(p)+len(tokens))
+ copy(child, p)
+ for i, token := range tokens {
+ child[len(p)+i] = child[:len(p)+i].inherit(pathToken{token: token})
+ }
+
+ return child
+}
+
+// item returns the location of the index'th element of the array at p.
+func (p pathSegments) item(index int) pathSegments {
+ return p.child(strconv.Itoa(index))
+}
+
+// isEmpty tells if p locates the document root.
+func (p pathSegments) isEmpty() bool { return len(p) == 0 }
+
+// last returns the trailing meaningful token, or an empty string at the
+// document root.
+//
+// Structural tokens are skipped: they say how a document addresses the value,
+// not what the value is, and the callers here are asking the latter.
+func (p pathSegments) last() string {
+ if token, ok := p.meaningfulAt(0); ok {
+ return token
+ }
+
+ return ""
+}
+
+// beforeLast returns the meaningful token before the trailing one, or an empty
+// string when p holds fewer than two of them.
+func (p pathSegments) beforeLast() string {
+ if token, ok := p.meaningfulAt(1); ok {
+ return token
+ }
+
+ return ""
+}
+
+// meaningfulAt returns the nth token from the end, counting only the tokens a
+// message would show.
+func (p pathSegments) meaningfulAt(n int) (string, bool) {
+ seen := 0
+ for _, token := range slices.Backward(p) {
+ if token.structural {
+ continue
+ }
+
+ if seen == n {
+ return token.token, true
+ }
+
+ seen++
+ }
+
+ return "", false
+}
+
+// trimIndexes returns p without its trailing array index tokens.
+//
+// It answers "what is this value inside of", disregarding how deep into an
+// array it sits: the items of an example are still an example.
+func (p pathSegments) trimIndexes() pathSegments {
+ end := len(p)
+ for end > 0 && isIndexToken(p[end-1].token) {
+ end--
+ }
+
+ return p[:end]
+}
+
+// isIndexToken tells if a token addresses an array element rather than a member.
+func isIndexToken(token string) bool {
+ if token == "" {
+ return false
+ }
+
+ for _, r := range token {
+ if r < '0' || r > '9' {
+ return false
+ }
+ }
+
+ return true
+}
+
+// hasSuffix tells if p ends with the given sequence of tokens.
+func (p pathSegments) hasSuffix(suffix pathSegments) bool {
+ if len(suffix) > len(p) {
+ return false
+ }
+
+ offset := len(p) - len(suffix)
+ for i, token := range suffix {
+ if p[offset+i].token != token.token {
+ return false
+ }
+ }
+
+ return true
+}
+
+// dotted renders the location in the legacy dot-separated notation, e.g.
+// "definitions.Pet.friends.0.name".
+//
+// Tokens are emitted verbatim: a token containing a dot is indistinguishable
+// from a separator. This notation is kept because it is what surfaces as the
+// name of a validation error, and API consumers of go-swagger servers see it.
+// Use [pathSegments.pointer] whenever the location needs to be unambiguous.
+func (p pathSegments) dotted() string {
+ readable := make([]string, 0, len(p))
+ for _, token := range p {
+ if token.structural {
+ continue
+ }
+
+ readable = append(readable, token.readable())
+ }
+
+ return strings.Join(readable, ".")
+}
+
+// pointer renders the location as an RFC 6901 JSON pointer, e.g.
+// "/definitions/Pet/friends/0/name". The document root renders as "".
+func (p pathSegments) pointer() string {
+ if len(p) == 0 {
+ return ""
+ }
+
+ var w strings.Builder
+ for _, token := range p {
+ if token.cosmetic {
+ continue
+ }
+
+ w.WriteByte('/')
+ w.WriteString(jsonpointer.Escape(token.token))
+ }
+
+ return w.String()
+}
diff --git a/vendor/github.com/go-openapi/validate/pools.go b/vendor/github.com/go-openapi/validate/pools.go
index c8936bd10b..0bc95d1aa6 100644
--- a/vendor/github.com/go-openapi/validate/pools.go
+++ b/vendor/github.com/go-openapi/validate/pools.go
@@ -1,369 +1,87 @@
// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0
-//go:build !validatedebug
-
package validate
import (
- "sync"
-
"github.com/go-openapi/spec"
+ "github.com/go-openapi/swag/pools"
)
-var pools allPools
+// validatorPools recycles the objects allocated while validating.
+//
+// Validation allocates a validator per schema node and a result per check, so
+// the same handful of types are built and thrown away constantly. Recycling
+// them is what keeps validating a large specification affordable.
+//
+// Build with the "poolsdebug" tag to have every borrow and redeem tracked:
+// misuse then panics where it happens rather than corrupting a pool, and
+// [pools.AssertNoLeaks] reports what was borrowed and never given back.
+var validatorPools allPools
func init() {
resetPools()
}
+// resetPools builds a fresh set of pools.
+//
+// Recycling an object twice leaves a pool holding it twice, and it would then
+// be handed to two borrowers at once. A test that provokes such misuse has to
+// start the next one from clean pools.
func resetPools() {
- // NOTE: for testing purpose, we might want to reset pools after calling Validate twice.
- // The pool is corrupted in that case: calling Put twice inserts a duplicate in the pool
- // and further calls to Get are mishandled.
-
- pools = allPools{
- poolOfSchemaValidators: schemaValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &SchemaValidator{}
-
- return s
- },
- },
- },
- poolOfObjectValidators: objectValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &objectValidator{}
-
- return s
- },
- },
- },
- poolOfSliceValidators: sliceValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &schemaSliceValidator{}
-
- return s
- },
- },
- },
- poolOfItemsValidators: itemsValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &itemsValidator{}
-
- return s
- },
- },
- },
- poolOfBasicCommonValidators: basicCommonValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &basicCommonValidator{}
-
- return s
- },
- },
- },
- poolOfHeaderValidators: headerValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &HeaderValidator{}
-
- return s
- },
- },
- },
- poolOfParamValidators: paramValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &ParamValidator{}
-
- return s
- },
- },
- },
- poolOfBasicSliceValidators: basicSliceValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &basicSliceValidator{}
-
- return s
- },
- },
- },
- poolOfNumberValidators: numberValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &numberValidator{}
-
- return s
- },
- },
- },
- poolOfStringValidators: stringValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &stringValidator{}
-
- return s
- },
- },
- },
- poolOfSchemaPropsValidators: schemaPropsValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &schemaPropsValidator{}
-
- return s
- },
- },
- },
- poolOfFormatValidators: formatValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &formatValidator{}
-
- return s
- },
- },
- },
- poolOfTypeValidators: typeValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &typeValidator{}
-
- return s
- },
- },
- },
- poolOfSchemas: schemasPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &spec.Schema{}
-
- return s
- },
- },
- },
- poolOfResults: resultsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &Result{}
-
- return s
- },
- },
- },
- }
-}
-
-type (
- allPools struct {
- // memory pools for all validator objects.
- //
- // Each pool can be borrowed from and redeemed to.
- poolOfSchemaValidators schemaValidatorsPool
- poolOfObjectValidators objectValidatorsPool
- poolOfSliceValidators sliceValidatorsPool
- poolOfItemsValidators itemsValidatorsPool
- poolOfBasicCommonValidators basicCommonValidatorsPool
- poolOfHeaderValidators headerValidatorsPool
- poolOfParamValidators paramValidatorsPool
- poolOfBasicSliceValidators basicSliceValidatorsPool
- poolOfNumberValidators numberValidatorsPool
- poolOfStringValidators stringValidatorsPool
- poolOfSchemaPropsValidators schemaPropsValidatorsPool
- poolOfFormatValidators formatValidatorsPool
- poolOfTypeValidators typeValidatorsPool
- poolOfSchemas schemasPool
- poolOfResults resultsPool
- }
-
- schemaValidatorsPool struct {
- *sync.Pool
- }
-
- objectValidatorsPool struct {
- *sync.Pool
- }
-
- sliceValidatorsPool struct {
- *sync.Pool
- }
-
- itemsValidatorsPool struct {
- *sync.Pool
- }
-
- basicCommonValidatorsPool struct {
- *sync.Pool
- }
-
- headerValidatorsPool struct {
- *sync.Pool
- }
-
- paramValidatorsPool struct {
- *sync.Pool
- }
-
- basicSliceValidatorsPool struct {
- *sync.Pool
- }
-
- numberValidatorsPool struct {
- *sync.Pool
- }
-
- stringValidatorsPool struct {
- *sync.Pool
- }
-
- schemaPropsValidatorsPool struct {
- *sync.Pool
- }
-
- formatValidatorsPool struct {
- *sync.Pool
- }
-
- typeValidatorsPool struct {
- *sync.Pool
- }
-
- schemasPool struct {
- *sync.Pool
- }
-
- resultsPool struct {
- *sync.Pool
- }
-)
-
-func (p schemaValidatorsPool) BorrowValidator() *SchemaValidator {
- return p.Get().(*SchemaValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p schemaValidatorsPool) RedeemValidator(s *SchemaValidator) {
- // NOTE: s might be nil. In that case, Put is a noop.
- p.Put(s)
-}
-
-func (p objectValidatorsPool) BorrowValidator() *objectValidator {
- return p.Get().(*objectValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p objectValidatorsPool) RedeemValidator(s *objectValidator) {
- p.Put(s)
-}
-
-func (p sliceValidatorsPool) BorrowValidator() *schemaSliceValidator {
- return p.Get().(*schemaSliceValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p sliceValidatorsPool) RedeemValidator(s *schemaSliceValidator) {
- p.Put(s)
-}
-
-func (p itemsValidatorsPool) BorrowValidator() *itemsValidator {
- return p.Get().(*itemsValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p itemsValidatorsPool) RedeemValidator(s *itemsValidator) {
- p.Put(s)
-}
-
-func (p basicCommonValidatorsPool) BorrowValidator() *basicCommonValidator {
- return p.Get().(*basicCommonValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p basicCommonValidatorsPool) RedeemValidator(s *basicCommonValidator) {
- p.Put(s)
-}
-
-func (p headerValidatorsPool) BorrowValidator() *HeaderValidator {
- return p.Get().(*HeaderValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p headerValidatorsPool) RedeemValidator(s *HeaderValidator) {
- p.Put(s)
-}
-
-func (p paramValidatorsPool) BorrowValidator() *ParamValidator {
- return p.Get().(*ParamValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p paramValidatorsPool) RedeemValidator(s *ParamValidator) {
- p.Put(s)
-}
-
-func (p basicSliceValidatorsPool) BorrowValidator() *basicSliceValidator {
- return p.Get().(*basicSliceValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p basicSliceValidatorsPool) RedeemValidator(s *basicSliceValidator) {
- p.Put(s)
-}
-
-func (p numberValidatorsPool) BorrowValidator() *numberValidator {
- return p.Get().(*numberValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p numberValidatorsPool) RedeemValidator(s *numberValidator) {
- p.Put(s)
-}
-
-func (p stringValidatorsPool) BorrowValidator() *stringValidator {
- return p.Get().(*stringValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p stringValidatorsPool) RedeemValidator(s *stringValidator) {
- p.Put(s)
-}
-
-func (p schemaPropsValidatorsPool) BorrowValidator() *schemaPropsValidator {
- return p.Get().(*schemaPropsValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p schemaPropsValidatorsPool) RedeemValidator(s *schemaPropsValidator) {
- p.Put(s)
-}
-
-func (p formatValidatorsPool) BorrowValidator() *formatValidator {
- return p.Get().(*formatValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p formatValidatorsPool) RedeemValidator(s *formatValidator) {
- p.Put(s)
-}
-
-func (p typeValidatorsPool) BorrowValidator() *typeValidator {
- return p.Get().(*typeValidator) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p typeValidatorsPool) RedeemValidator(s *typeValidator) {
- p.Put(s)
-}
-
-func (p schemasPool) BorrowSchema() *spec.Schema {
- return p.Get().(*spec.Schema) //nolint:forcetypeassert // pool New always returns this type
-}
-
-func (p schemasPool) RedeemSchema(s *spec.Schema) {
- p.Put(s)
-}
-
-func (p resultsPool) BorrowResult() *Result {
- return p.Get().(*Result).cleared() //nolint:forcetypeassert // pool New always returns *Result
-}
-
-func (p resultsPool) RedeemResult(s *Result) {
- if s == emptyResult {
+ validatorPools = allPools{
+ schemaValidators: pools.New[SchemaValidator](),
+ objectValidators: pools.New[objectValidator](),
+ sliceValidators: pools.New[schemaSliceValidator](),
+ itemsValidators: pools.New[itemsValidator](),
+ basicCommonValidators: pools.New[basicCommonValidator](),
+ headerValidators: pools.New[HeaderValidator](),
+ paramValidators: pools.New[ParamValidator](),
+ basicSliceValidators: pools.New[basicSliceValidator](),
+ numberValidators: pools.New[numberValidator](),
+ stringValidators: pools.New[stringValidator](),
+ schemaPropsValidators: pools.New[schemaPropsValidator](),
+ formatValidators: pools.New[formatValidator](),
+ typeValidators: pools.New[typeValidator](),
+ schemas: pools.New[spec.Schema](),
+ results: pools.New[Result](),
+ }
+}
+
+// allPools is the set of pools shared by the validators of this package.
+type allPools struct {
+ schemaValidators *pools.Pool[SchemaValidator]
+ objectValidators *pools.Pool[objectValidator]
+ sliceValidators *pools.Pool[schemaSliceValidator]
+ itemsValidators *pools.Pool[itemsValidator]
+ basicCommonValidators *pools.Pool[basicCommonValidator]
+ headerValidators *pools.Pool[HeaderValidator]
+ paramValidators *pools.Pool[ParamValidator]
+ basicSliceValidators *pools.Pool[basicSliceValidator]
+ numberValidators *pools.Pool[numberValidator]
+ stringValidators *pools.Pool[stringValidator]
+ schemaPropsValidators *pools.Pool[schemaPropsValidator]
+ formatValidators *pools.Pool[formatValidator]
+ typeValidators *pools.Pool[typeValidator]
+ schemas *pools.Pool[spec.Schema]
+ results *pools.Pool[Result]
+}
+
+// redeemResult returns a result to the pool.
+//
+// emptyResult is a shared value that was never borrowed, so it is not the
+// pool's to take back: handing it over would be reported as a foreign redeem,
+// rightly.
+//
+// Results are borrowed straight from the pool rather than through a helper,
+// so that the instrumented build attributes a leak to the code that borrowed it.
+//
+// This wrapper costs that attribution on redeem, where a double redeem still
+// names the offending call site in the panic it raises.
+func redeemResult(r *Result) {
+ if r == emptyResult {
return
}
- p.Put(s)
+
+ validatorPools.results.Redeem(r)
}
diff --git a/vendor/github.com/go-openapi/validate/pools_debug.go b/vendor/github.com/go-openapi/validate/pools_debug.go
deleted file mode 100644
index d123ed4093..0000000000
--- a/vendor/github.com/go-openapi/validate/pools_debug.go
+++ /dev/null
@@ -1,1015 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
-// SPDX-License-Identifier: Apache-2.0
-
-//go:build validatedebug
-
-package validate
-
-import (
- "fmt"
- "runtime"
- "sync"
- "testing"
-
- "github.com/go-openapi/spec"
-)
-
-// This version of the pools is to be used for debugging and testing, with build tag "validatedebug".
-//
-// In this mode, the pools are tracked for allocation and redemption of borrowed objects, so we can
-// verify a few behaviors of the validators. The debug pools panic when an invalid usage pattern is detected.
-
-var pools allPools
-
-func init() {
- resetPools()
-}
-
-func resetPools() {
- // NOTE: for testing purpose, we might want to reset pools after calling Validate twice.
- // The pool is corrupted in that case: calling Put twice inserts a duplicate in the pool
- // and further calls to Get are mishandled.
-
- pools = allPools{
- poolOfSchemaValidators: schemaValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &SchemaValidator{}
-
- return s
- },
- },
- debugMap: make(map[*SchemaValidator]status),
- allocMap: make(map[*SchemaValidator]string),
- redeemMap: make(map[*SchemaValidator]string),
- },
- poolOfObjectValidators: objectValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &objectValidator{}
-
- return s
- },
- },
- debugMap: make(map[*objectValidator]status),
- allocMap: make(map[*objectValidator]string),
- redeemMap: make(map[*objectValidator]string),
- },
- poolOfSliceValidators: sliceValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &schemaSliceValidator{}
-
- return s
- },
- },
- debugMap: make(map[*schemaSliceValidator]status),
- allocMap: make(map[*schemaSliceValidator]string),
- redeemMap: make(map[*schemaSliceValidator]string),
- },
- poolOfItemsValidators: itemsValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &itemsValidator{}
-
- return s
- },
- },
- debugMap: make(map[*itemsValidator]status),
- allocMap: make(map[*itemsValidator]string),
- redeemMap: make(map[*itemsValidator]string),
- },
- poolOfBasicCommonValidators: basicCommonValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &basicCommonValidator{}
-
- return s
- },
- },
- debugMap: make(map[*basicCommonValidator]status),
- allocMap: make(map[*basicCommonValidator]string),
- redeemMap: make(map[*basicCommonValidator]string),
- },
- poolOfHeaderValidators: headerValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &HeaderValidator{}
-
- return s
- },
- },
- debugMap: make(map[*HeaderValidator]status),
- allocMap: make(map[*HeaderValidator]string),
- redeemMap: make(map[*HeaderValidator]string),
- },
- poolOfParamValidators: paramValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &ParamValidator{}
-
- return s
- },
- },
- debugMap: make(map[*ParamValidator]status),
- allocMap: make(map[*ParamValidator]string),
- redeemMap: make(map[*ParamValidator]string),
- },
- poolOfBasicSliceValidators: basicSliceValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &basicSliceValidator{}
-
- return s
- },
- },
- debugMap: make(map[*basicSliceValidator]status),
- allocMap: make(map[*basicSliceValidator]string),
- redeemMap: make(map[*basicSliceValidator]string),
- },
- poolOfNumberValidators: numberValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &numberValidator{}
-
- return s
- },
- },
- debugMap: make(map[*numberValidator]status),
- allocMap: make(map[*numberValidator]string),
- redeemMap: make(map[*numberValidator]string),
- },
- poolOfStringValidators: stringValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &stringValidator{}
-
- return s
- },
- },
- debugMap: make(map[*stringValidator]status),
- allocMap: make(map[*stringValidator]string),
- redeemMap: make(map[*stringValidator]string),
- },
- poolOfSchemaPropsValidators: schemaPropsValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &schemaPropsValidator{}
-
- return s
- },
- },
- debugMap: make(map[*schemaPropsValidator]status),
- allocMap: make(map[*schemaPropsValidator]string),
- redeemMap: make(map[*schemaPropsValidator]string),
- },
- poolOfFormatValidators: formatValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &formatValidator{}
-
- return s
- },
- },
- debugMap: make(map[*formatValidator]status),
- allocMap: make(map[*formatValidator]string),
- redeemMap: make(map[*formatValidator]string),
- },
- poolOfTypeValidators: typeValidatorsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &typeValidator{}
-
- return s
- },
- },
- debugMap: make(map[*typeValidator]status),
- allocMap: make(map[*typeValidator]string),
- redeemMap: make(map[*typeValidator]string),
- },
- poolOfSchemas: schemasPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &spec.Schema{}
-
- return s
- },
- },
- debugMap: make(map[*spec.Schema]status),
- allocMap: make(map[*spec.Schema]string),
- redeemMap: make(map[*spec.Schema]string),
- },
- poolOfResults: resultsPool{
- Pool: &sync.Pool{
- New: func() any {
- s := &Result{}
-
- return s
- },
- },
- debugMap: make(map[*Result]status),
- allocMap: make(map[*Result]string),
- redeemMap: make(map[*Result]string),
- },
- }
-}
-
-const (
- statusFresh status = iota + 1
- statusRecycled
- statusRedeemed
-)
-
-func (s status) String() string {
- switch s {
- case statusFresh:
- return "fresh"
- case statusRecycled:
- return "recycled"
- case statusRedeemed:
- return "redeemed"
- default:
- panic(fmt.Errorf("invalid status: %d", s))
- }
-}
-
-type (
- // Debug
- status uint8
-
- allPools struct {
- // memory pools for all validator objects.
- //
- // Each pool can be borrowed from and redeemed to.
- poolOfSchemaValidators schemaValidatorsPool
- poolOfObjectValidators objectValidatorsPool
- poolOfSliceValidators sliceValidatorsPool
- poolOfItemsValidators itemsValidatorsPool
- poolOfBasicCommonValidators basicCommonValidatorsPool
- poolOfHeaderValidators headerValidatorsPool
- poolOfParamValidators paramValidatorsPool
- poolOfBasicSliceValidators basicSliceValidatorsPool
- poolOfNumberValidators numberValidatorsPool
- poolOfStringValidators stringValidatorsPool
- poolOfSchemaPropsValidators schemaPropsValidatorsPool
- poolOfFormatValidators formatValidatorsPool
- poolOfTypeValidators typeValidatorsPool
- poolOfSchemas schemasPool
- poolOfResults resultsPool
- }
-
- schemaValidatorsPool struct {
- *sync.Pool
- debugMap map[*SchemaValidator]status
- allocMap map[*SchemaValidator]string
- redeemMap map[*SchemaValidator]string
- mx sync.Mutex
- }
-
- objectValidatorsPool struct {
- *sync.Pool
- debugMap map[*objectValidator]status
- allocMap map[*objectValidator]string
- redeemMap map[*objectValidator]string
- mx sync.Mutex
- }
-
- sliceValidatorsPool struct {
- *sync.Pool
- debugMap map[*schemaSliceValidator]status
- allocMap map[*schemaSliceValidator]string
- redeemMap map[*schemaSliceValidator]string
- mx sync.Mutex
- }
-
- itemsValidatorsPool struct {
- *sync.Pool
- debugMap map[*itemsValidator]status
- allocMap map[*itemsValidator]string
- redeemMap map[*itemsValidator]string
- mx sync.Mutex
- }
-
- basicCommonValidatorsPool struct {
- *sync.Pool
- debugMap map[*basicCommonValidator]status
- allocMap map[*basicCommonValidator]string
- redeemMap map[*basicCommonValidator]string
- mx sync.Mutex
- }
-
- headerValidatorsPool struct {
- *sync.Pool
- debugMap map[*HeaderValidator]status
- allocMap map[*HeaderValidator]string
- redeemMap map[*HeaderValidator]string
- mx sync.Mutex
- }
-
- paramValidatorsPool struct {
- *sync.Pool
- debugMap map[*ParamValidator]status
- allocMap map[*ParamValidator]string
- redeemMap map[*ParamValidator]string
- mx sync.Mutex
- }
-
- basicSliceValidatorsPool struct {
- *sync.Pool
- debugMap map[*basicSliceValidator]status
- allocMap map[*basicSliceValidator]string
- redeemMap map[*basicSliceValidator]string
- mx sync.Mutex
- }
-
- numberValidatorsPool struct {
- *sync.Pool
- debugMap map[*numberValidator]status
- allocMap map[*numberValidator]string
- redeemMap map[*numberValidator]string
- mx sync.Mutex
- }
-
- stringValidatorsPool struct {
- *sync.Pool
- debugMap map[*stringValidator]status
- allocMap map[*stringValidator]string
- redeemMap map[*stringValidator]string
- mx sync.Mutex
- }
-
- schemaPropsValidatorsPool struct {
- *sync.Pool
- debugMap map[*schemaPropsValidator]status
- allocMap map[*schemaPropsValidator]string
- redeemMap map[*schemaPropsValidator]string
- mx sync.Mutex
- }
-
- formatValidatorsPool struct {
- *sync.Pool
- debugMap map[*formatValidator]status
- allocMap map[*formatValidator]string
- redeemMap map[*formatValidator]string
- mx sync.Mutex
- }
-
- typeValidatorsPool struct {
- *sync.Pool
- debugMap map[*typeValidator]status
- allocMap map[*typeValidator]string
- redeemMap map[*typeValidator]string
- mx sync.Mutex
- }
-
- schemasPool struct {
- *sync.Pool
- debugMap map[*spec.Schema]status
- allocMap map[*spec.Schema]string
- redeemMap map[*spec.Schema]string
- mx sync.Mutex
- }
-
- resultsPool struct {
- *sync.Pool
- debugMap map[*Result]status
- allocMap map[*Result]string
- redeemMap map[*Result]string
- mx sync.Mutex
- }
-)
-
-func (p *schemaValidatorsPool) BorrowValidator() *SchemaValidator {
- s := p.Get().(*SchemaValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled schema should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *schemaValidatorsPool) RedeemValidator(s *SchemaValidator) {
- // NOTE: s might be nil. In that case, Put is a noop.
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed schema should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed schema should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *objectValidatorsPool) BorrowValidator() *objectValidator {
- s := p.Get().(*objectValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled object should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *objectValidatorsPool) RedeemValidator(s *objectValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed object should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed object should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *sliceValidatorsPool) BorrowValidator() *schemaSliceValidator {
- s := p.Get().(*schemaSliceValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled schemaSliceValidator should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *sliceValidatorsPool) RedeemValidator(s *schemaSliceValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed schemaSliceValidator should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed schemaSliceValidator should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *itemsValidatorsPool) BorrowValidator() *itemsValidator {
- s := p.Get().(*itemsValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled itemsValidator should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *itemsValidatorsPool) RedeemValidator(s *itemsValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed itemsValidator should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed itemsValidator should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *basicCommonValidatorsPool) BorrowValidator() *basicCommonValidator {
- s := p.Get().(*basicCommonValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled basicCommonValidator should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *basicCommonValidatorsPool) RedeemValidator(s *basicCommonValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed basicCommonValidator should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed basicCommonValidator should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *headerValidatorsPool) BorrowValidator() *HeaderValidator {
- s := p.Get().(*HeaderValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled HeaderValidator should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *headerValidatorsPool) RedeemValidator(s *HeaderValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed header should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed header should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *paramValidatorsPool) BorrowValidator() *ParamValidator {
- s := p.Get().(*ParamValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled param should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *paramValidatorsPool) RedeemValidator(s *ParamValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed param should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed param should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *basicSliceValidatorsPool) BorrowValidator() *basicSliceValidator {
- s := p.Get().(*basicSliceValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled basicSliceValidator should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *basicSliceValidatorsPool) RedeemValidator(s *basicSliceValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed basicSliceValidator should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed basicSliceValidator should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *numberValidatorsPool) BorrowValidator() *numberValidator {
- s := p.Get().(*numberValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled number should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *numberValidatorsPool) RedeemValidator(s *numberValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed number should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed number should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *stringValidatorsPool) BorrowValidator() *stringValidator {
- s := p.Get().(*stringValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled string should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *stringValidatorsPool) RedeemValidator(s *stringValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed string should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed string should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *schemaPropsValidatorsPool) BorrowValidator() *schemaPropsValidator {
- s := p.Get().(*schemaPropsValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled param should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *schemaPropsValidatorsPool) RedeemValidator(s *schemaPropsValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed schemaProps should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed schemaProps should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *formatValidatorsPool) BorrowValidator() *formatValidator {
- s := p.Get().(*formatValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled format should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *formatValidatorsPool) RedeemValidator(s *formatValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed format should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed format should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *typeValidatorsPool) BorrowValidator() *typeValidator {
- s := p.Get().(*typeValidator)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled type should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *typeValidatorsPool) RedeemValidator(s *typeValidator) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed type should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic(fmt.Errorf("redeemed type should have been allocated from a fresh or recycled pointer. Got status %s, already redeamed at: %s", x, p.redeemMap[s]))
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *schemasPool) BorrowSchema() *spec.Schema {
- s := p.Get().(*spec.Schema)
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled spec.Schema should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *schemasPool) RedeemSchema(s *spec.Schema) {
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed spec.Schema should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed spec.Schema should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *resultsPool) BorrowResult() *Result {
- s := p.Get().(*Result).cleared()
-
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- p.debugMap[s] = statusFresh
- } else {
- if x != statusRedeemed {
- panic("recycled result should have been redeemed")
- }
- p.debugMap[s] = statusRecycled
- }
- p.allocMap[s] = caller()
-
- return s
-}
-
-func (p *resultsPool) RedeemResult(s *Result) {
- if s == emptyResult {
- if len(s.Errors) > 0 || len(s.Warnings) > 0 {
- panic("empty result should not mutate")
- }
- return
- }
- p.mx.Lock()
- defer p.mx.Unlock()
- x, ok := p.debugMap[s]
- if !ok {
- panic("redeemed Result should have been allocated")
- }
- if x != statusRecycled && x != statusFresh {
- panic("redeemed Result should have been allocated from a fresh or recycled pointer")
- }
- p.debugMap[s] = statusRedeemed
- p.redeemMap[s] = caller()
- p.Put(s)
-}
-
-func (p *allPools) allIsRedeemed(t testing.TB) bool {
- outcome := true
- for k, v := range p.poolOfSchemaValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("schemaValidator should be redeemed. Allocated by: %s", p.poolOfSchemaValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfObjectValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("objectValidator should be redeemed. Allocated by: %s", p.poolOfObjectValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfSliceValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("sliceValidator should be redeemed. Allocated by: %s", p.poolOfSliceValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfItemsValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("itemsValidator should be redeemed. Allocated by: %s", p.poolOfItemsValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfBasicCommonValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("basicCommonValidator should be redeemed. Allocated by: %s", p.poolOfBasicCommonValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfHeaderValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("headerValidator should be redeemed. Allocated by: %s", p.poolOfHeaderValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfParamValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("paramValidator should be redeemed. Allocated by: %s", p.poolOfParamValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfBasicSliceValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("basicSliceValidator should be redeemed. Allocated by: %s", p.poolOfBasicSliceValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfNumberValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("numberValidator should be redeemed. Allocated by: %s", p.poolOfNumberValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfStringValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("stringValidator should be redeemed. Allocated by: %s", p.poolOfStringValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfSchemaPropsValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("schemaPropsValidator should be redeemed. Allocated by: %s", p.poolOfSchemaPropsValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfFormatValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("formatValidator should be redeemed. Allocated by: %s", p.poolOfFormatValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfTypeValidators.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("typeValidator should be redeemed. Allocated by: %s", p.poolOfTypeValidators.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfSchemas.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("schemas should be redeemed. Allocated by: %s", p.poolOfSchemas.allocMap[k])
- outcome = false
- }
- for k, v := range p.poolOfResults.debugMap {
- if v == statusRedeemed {
- continue
- }
- t.Logf("result should be redeemed. Allocated by: %s", p.poolOfResults.allocMap[k])
- outcome = false
- }
-
- return outcome
-}
-
-func caller() string {
- pc, _, _, _ := runtime.Caller(3) //nolint:dogsled
- from, line := runtime.FuncForPC(pc).FileLine(pc)
-
- return fmt.Sprintf("%s:%d", from, line)
-}
diff --git a/vendor/github.com/go-openapi/validate/ref_locations.go b/vendor/github.com/go-openapi/validate/ref_locations.go
new file mode 100644
index 0000000000..1853340d22
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/ref_locations.go
@@ -0,0 +1,49 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "github.com/go-openapi/analysis"
+)
+
+// refLocations tells where a $ref value is declared in a document.
+//
+// The analyzer indexes references the other way around, by the location each
+// was found at, so the index is inverted here. Only declarations are indexed:
+// a "$ref" member sitting in an example or in a default value is data, and the
+// analyzer never walks into it.
+type refLocations map[string]pathSegments
+
+// newRefLocations inverts the analyzer's reference index.
+//
+// A reference declared in several places keeps the smallest declaration, so
+// that the answer does not depend on map iteration order.
+func newRefLocations(analyzer *analysis.Spec) refLocations {
+ declarations := make(map[string]string)
+ for location, ref := range analyzer.AllRefsByLocation() {
+ value := ref.String()
+ if value == "" {
+ continue
+ }
+
+ if known, isKnown := declarations[value]; isKnown && known <= location {
+ continue
+ }
+
+ declarations[value] = location
+ }
+
+ locations := make(refLocations, len(declarations))
+ for value, location := range declarations {
+ locations[value] = localRefPath(location)
+ }
+
+ return locations
+}
+
+// at returns where a reference is declared, or the document root when the
+// reference is not one the analyzer indexed.
+func (l refLocations) at(ref string) pathSegments {
+ return l[ref]
+}
diff --git a/vendor/github.com/go-openapi/validate/ref_redirects.go b/vendor/github.com/go-openapi/validate/ref_redirects.go
new file mode 100644
index 0000000000..95fe96c229
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/ref_redirects.go
@@ -0,0 +1,71 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "strings"
+
+ "github.com/go-openapi/analysis"
+)
+
+// maxRefHops bounds how many $ref a pointer may be followed through, so that a
+// document referring to itself cannot spin here.
+const maxRefHops = 10
+
+// refRedirects maps the location of a $ref to the location it points at, for
+// the local references of a document.
+//
+// Checks walk the expanded document, so a finding below a $ref comes out with a
+// pointer that descends into a node the authored document does not contain: a
+// bare "$ref" member has nothing under it. Following the reference turns such a
+// pointer back into one the document addresses.
+type refRedirects map[string]string
+
+func newRefRedirects(analyzer *analysis.Spec) refRedirects {
+ redirects := make(refRedirects)
+ for location, ref := range analyzer.AllRefsByLocation() {
+ target := ref.String()
+ if !strings.HasPrefix(target, "#/") {
+ // only a local reference has a location in this document
+ continue
+ }
+
+ redirects[strings.TrimPrefix(location, "#")] = strings.TrimPrefix(target, "#")
+ }
+
+ return redirects
+}
+
+// through rewrites a pointer that descends below a $ref.
+//
+// A pointer that stops at the $ref itself is left alone: that node exists, and
+// it is where a reader has to go to amend the reference.
+func (r refRedirects) through(pointer string) string {
+ if len(r) == 0 {
+ return pointer
+ }
+
+ for range maxRefHops {
+ prefix, rest, ok := r.crossing(pointer)
+ if !ok {
+ return pointer
+ }
+
+ pointer = prefix + rest
+ }
+
+ return pointer
+}
+
+// crossing finds the longest prefix of pointer that holds a $ref, and returns
+// the location that reference points at together with what is left below it.
+func (r refRedirects) crossing(pointer string) (target, rest string, ok bool) {
+ for at := strings.LastIndex(pointer, "/"); at > 0; at = strings.LastIndex(pointer[:at], "/") {
+ if target, isRef := r[pointer[:at]]; isRef {
+ return target, pointer[at:], true
+ }
+ }
+
+ return "", "", false
+}
diff --git a/vendor/github.com/go-openapi/validate/required_walk.go b/vendor/github.com/go-openapi/validate/required_walk.go
new file mode 100644
index 0000000000..b3fd3cdf4a
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/required_walk.go
@@ -0,0 +1,179 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "strings"
+
+ "github.com/go-openapi/errors"
+ "github.com/go-openapi/spec"
+)
+
+// schemaIdentity is how a message refers to the schema a required entry
+// belongs to.
+//
+// A definition is named on its own, the way it always has been. A schema the
+// definition holds is named by the way down to it, relative to the definition:
+// "A.inner" rather than "A", which would send a reader to the wrong place.
+type schemaIdentity struct {
+ name string
+ nested bool
+}
+
+// identify names the schema a location leads to.
+func identify(at pathSegments) schemaIdentity {
+ const definitionDepth = 2 // "definitions", then the name of one
+
+ return schemaIdentity{
+ name: strings.TrimPrefix(at.dotted(), swaggerDefinitions+"."),
+ nested: len(at) > definitionDepth,
+ }
+}
+
+func (i schemaIdentity) requiredButNotDefined(property string) errors.Error {
+ if i.nested {
+ return requiredButNotDefinedInSchemaMsg(property, i.name)
+ }
+
+ return requiredButNotDefinedMsg(property, i.name)
+}
+
+// maxCompositionHops bounds how far the search for a declared property follows
+// allOf members and the local $ref they may be written as.
+const maxCompositionHops = 20
+
+// walkRequired checks the required entries of a schema, then those of every
+// schema it holds inline.
+//
+// A definition is not the only place a document says an object must hold a
+// property: so does the schema of a property, of an array item, of an
+// additionalProperties. Each of those is a self-contained object definition,
+// and a required entry naming something it never declares is the same slip
+// wherever it sits.
+//
+// A schema written as a $ref is left alone: it is checked where it is defined,
+// and following it here would report the same slip twice and, for a recursive
+// definition, would not terminate.
+//
+// It reports whether the walk should carry on, which is how the caller stops on
+// the first fault unless it was asked for everything.
+func (s *SpecValidator) walkRequired(at pathSegments, v *spec.Schema, res *Result) bool {
+ if v == nil || v.Ref.String() != "" {
+ return true
+ }
+
+ for i, pn := range v.Required {
+ // the offending entry of the required array, not the schema holding
+ // it: that is what a reader has to go and amend
+ red := s.validateRequiredProperties(pn, identify(at), at, at.child(jsonRequired).item(i), v)
+ // NOTE: capture validity before merging: Merge may redeem `red` to the
+ // pool (wantsRedeemOnMerge), after which reading it races with a
+ // concurrent BorrowResult().cleared() in another goroutine.
+ isValid := red.IsValid()
+ res.Merge(red)
+ if !isValid && !s.Options.ContinueOnErrors {
+ return false
+ }
+ }
+
+ return s.walkInlineSchemas(at, v, res)
+}
+
+// walkInlineSchemas descends into every schema a schema holds, without checking
+// the required entries of a composition member.
+//
+// Inside allOf, anyOf, oneOf or not, a member is a fragment of a constraint
+// rather than a complete definition: its required entries speak of the instance
+// the whole composition describes, and are legitimately met by a sibling member
+// or by no declaration at all. Those are honoured when data is validated, and
+// saying anything about them here would be wrong. Their own members are still
+// walked, because a property schema nested in one of them is a definition like
+// any other.
+func (s *SpecValidator) walkInlineSchemas(at pathSegments, v *spec.Schema, res *Result) bool {
+ for _, name := range sortedKeys(v.Properties) {
+ held := v.Properties[name]
+ if !s.walkRequired(at.structuralChild(jsonProperties).child(name), &held, res) {
+ return false
+ }
+ }
+
+ for _, pattern := range sortedKeys(v.PatternProperties) {
+ held := v.PatternProperties[pattern]
+ if !s.walkRequired(at.structuralChild(jsonPatternProperties).child(pattern), &held, res) {
+ return false
+ }
+ }
+
+ if v.Items != nil {
+ if v.Items.Schema != nil && !s.walkRequired(at.child(jsonItems), v.Items.Schema, res) {
+ return false
+ }
+ for i := range v.Items.Schemas {
+ if !s.walkRequired(at.child(jsonItems).item(i), &v.Items.Schemas[i], res) {
+ return false
+ }
+ }
+ }
+
+ if v.AdditionalProperties != nil && v.AdditionalProperties.Schema != nil &&
+ !s.walkRequired(at.child(jsonAdditionalProperties), v.AdditionalProperties.Schema, res) {
+ return false
+ }
+
+ // a composition member is walked for the schemas it holds, never for its
+ // own required entries
+ for _, composition := range []struct {
+ keyword string
+ members []spec.Schema
+ }{
+ {jsonAllOf, v.AllOf},
+ {jsonAnyOf, v.AnyOf},
+ {jsonOneOf, v.OneOf},
+ } {
+ for i := range composition.members {
+ if !s.walkInlineSchemas(at.child(composition.keyword).item(i), &composition.members[i], res) {
+ return false
+ }
+ }
+ }
+
+ if v.Not != nil {
+ return s.walkInlineSchemas(at.child(jsonNot), v.Not, res)
+ }
+
+ return true
+}
+
+// declaresProperty reports whether a schema, or any schema composed into it by
+// allOf, declares the named property, and whether that declaration is readOnly.
+//
+// An allOf member may be written as a $ref, which is followed here: a property
+// contributed by a base definition is declared just as plainly as one written
+// in place.
+func (s *SpecValidator) declaresProperty(v *spec.Schema, name string, hops int) (readOnly, declared bool) {
+ if v == nil || hops <= 0 {
+ return false, false
+ }
+
+ if held, ok := v.Properties[name]; ok {
+ return held.ReadOnly, true
+ }
+
+ for i := range v.AllOf {
+ member := &v.AllOf[i]
+ if member.Ref.String() != "" {
+ resolved, err := s.resolveRef(&member.Ref)
+ if err != nil {
+ continue
+ }
+ member = resolved
+ }
+
+ if readOnly, ok := s.declaresProperty(member, name, hops-1); ok {
+ return readOnly, true
+ }
+ }
+
+ return false, false
+}
diff --git a/vendor/github.com/go-openapi/validate/resolvable.go b/vendor/github.com/go-openapi/validate/resolvable.go
new file mode 100644
index 0000000000..bbd35d3608
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/resolvable.go
@@ -0,0 +1,70 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "strconv"
+ "strings"
+
+ "github.com/go-openapi/jsonpointer"
+)
+
+// resolvable trims a pointer down to the deepest node the document holds.
+//
+// Checks walk an expanded, model-level view of a specification, which holds
+// members the document itself never wrote: a parameter merged in from a path
+// item, a member of a schema reached through a $ref. A pointer built along the
+// way may therefore end on something a reader cannot go to.
+//
+// Trimming is the last word on a location, applied once every check has had its
+// say: it only ever shortens, so a pointer that already addressed a node comes
+// back untouched, and one that did not still says as much as it truthfully can.
+// This is what makes [Located.Pointer] always resolve.
+func (s *SpecValidator) resolvable(pointer string) string {
+ if pointer == "" || s.document == nil {
+ return pointer
+ }
+
+ node := s.document
+ for at := 0; at < len(pointer); {
+ end := strings.IndexByte(pointer[at+1:], '/')
+ token := pointer[at+1:]
+ if end >= 0 {
+ token = pointer[at+1 : at+1+end]
+ }
+
+ member, isHeld := memberOf(node, jsonpointer.Unescape(token))
+ if !isHeld {
+ return pointer[:at]
+ }
+ node = member
+
+ if end < 0 {
+ break
+ }
+ at += end + 1
+ }
+
+ return pointer
+}
+
+// memberOf returns the member a reference token addresses in a decoded JSON
+// node, and whether the node holds one at all.
+func memberOf(node any, token string) (any, bool) {
+ switch held := node.(type) {
+ case map[string]any:
+ member, isHeld := held[token]
+
+ return member, isHeld
+ case []any:
+ index, err := strconv.Atoi(token)
+ if err != nil || index < 0 || index >= len(held) {
+ return nil, false
+ }
+
+ return held[index], true
+ default:
+ return nil, false
+ }
+}
diff --git a/vendor/github.com/go-openapi/validate/result.go b/vendor/github.com/go-openapi/validate/result.go
index ede945503d..5684774a5f 100644
--- a/vendor/github.com/go-openapi/validate/result.go
+++ b/vendor/github.com/go-openapi/validate/result.go
@@ -14,6 +14,25 @@ import (
var emptyResult = &Result{MatchCount: 1}
+// Located pairs a validation error with the location of the value that caused it.
+type Located struct {
+ // Err is the reported error or warning.
+ Err error
+
+ // Pointer locates the offending value as an RFC 6901 JSON pointer,
+ // relative to the validated document.
+ //
+ // It is empty when the document as a whole is the answer: either because
+ // the finding is about the document rather than a value in it, such as a
+ // duplicate operation id, or because the value in question is the root.
+ // An empty pointer is a valid one, addressing the whole document.
+ //
+ // A finding about something a document does not contain, a missing
+ // required property say, is located on the value that should contain it:
+ // what is absent has no node to point at.
+ Pointer string
+}
+
// Result represents a validation result set, composed of
// errors and warnings.
//
@@ -25,12 +44,17 @@ var emptyResult = &Result{MatchCount: 1}
// schema validation. Results from the validation branch
// with most matches get eventually selected.
//
-// Proposal for enhancement: keep path of key originating the error.
+// Use [Result.LocatedErrors] to know where each error happened.
type Result struct {
Errors []error
Warnings []error
MatchCount int
+ // errorLocations[i] locates Errors[i], and likewise for warnings. Kept
+ // aligned by the add methods; see [Result.LocatedErrors].
+ errorLocations []string
+ warningLocations []string
+
// the object data
data any
@@ -110,7 +134,7 @@ func (r *Result) Merge(others ...*Result) *Result {
r.mergeWithoutRootSchemata(other)
r.rootObjectSchemata.Append(other.rootObjectSchemata)
if other.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(other)
+ redeemResult(other)
}
}
return r
@@ -173,11 +197,11 @@ func (r *Result) MergeAsErrors(others ...*Result) *Result {
for _, other := range others {
if other != nil {
r.resetCaches()
- r.AddErrors(other.Errors...)
- r.AddErrors(other.Warnings...)
+ r.carryErrors(other.Errors, other.errorLocations)
+ r.carryErrors(other.Warnings, other.warningLocations)
r.MatchCount += other.MatchCount
if other.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(other)
+ redeemResult(other)
}
}
}
@@ -191,11 +215,11 @@ func (r *Result) MergeAsWarnings(others ...*Result) *Result {
for _, other := range others {
if other != nil {
r.resetCaches()
- r.AddWarnings(other.Errors...)
- r.AddWarnings(other.Warnings...)
+ r.carryWarnings(other.Errors, other.errorLocations)
+ r.carryWarnings(other.Warnings, other.warningLocations)
r.MatchCount += other.MatchCount
if other.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(other)
+ redeemResult(other)
}
}
}
@@ -207,39 +231,79 @@ func (r *Result) MergeAsWarnings(others ...*Result) *Result {
// Since the same check may be passed several times while exploring the
// spec structure (via $ref, ...) reported messages are kept
// unique.
+//
+// Errors added this way carry no location. Validators use [Result.addErrorsAt]
+// so that [Result.LocatedErrors] can tell where the failure happened.
func (r *Result) AddErrors(errors ...error) {
- for _, e := range errors {
- found := false
- if e != nil {
- for _, isReported := range r.Errors {
- if e.Error() == isReported.Error() {
- found = true
- break
- }
- }
- if !found {
- r.Errors = append(r.Errors, e)
- }
- }
- }
+ r.addLocatedErrors("", errors...)
}
// AddWarnings adds warnings to this validation result (if not already reported).
func (r *Result) AddWarnings(warnings ...error) {
- for _, e := range warnings {
- found := false
- if e != nil {
- for _, isReported := range r.Warnings {
- if e.Error() == isReported.Error() {
- found = true
- break
- }
- }
- if !found {
- r.Warnings = append(r.Warnings, e)
- }
+ r.addLocatedWarnings("", warnings...)
+}
+
+// isReportedError tells if the same message is already part of a collection.
+func isReportedError(reported []error, e error) bool {
+ msg := e.Error()
+ for _, isReported := range reported {
+ if msg == isReported.Error() {
+ return true
}
}
+
+ return false
+}
+
+// locationAt reads a location out of a slice that may be shorter than the
+// errors it describes.
+func locationAt(locations []string, i int) string {
+ if i < len(locations) {
+ return locations[i]
+ }
+
+ return ""
+}
+
+// appendLocation records the location of the error that has just been appended,
+// keeping the location slice aligned with the error slice it describes.
+//
+// Errors may reach a Result without going through the methods here (a caller
+// assigning Errors directly, say), so the slice is padded rather than assumed
+// to be in step.
+func appendLocation(locations []string, upTo int, pointer string) []string {
+ for len(locations) < upTo-1 {
+ locations = append(locations, "")
+ }
+
+ return append(locations, pointer)
+}
+
+// LocatedErrors returns the reported errors, each paired with the JSON pointer
+// of the value that caused it.
+//
+// The pointer is empty whenever the location is unknown, so callers should
+// treat it as a hint and keep using the error message as the primary report.
+func (r *Result) LocatedErrors() []Located {
+ return locate(r.Errors, r.errorLocations)
+}
+
+// LocatedWarnings returns the reported warnings, each paired with the JSON
+// pointer of the value that caused it.
+func (r *Result) LocatedWarnings() []Located {
+ return locate(r.Warnings, r.warningLocations)
+}
+
+func locate(errs []error, locations []string) []Located {
+ located := make([]Located, len(errs))
+ for i, err := range errs {
+ located[i] = Located{Err: err}
+ if i < len(locations) {
+ located[i].Pointer = locations[i]
+ }
+ }
+
+ return located
}
// IsValid returns true when this result is valid.
@@ -298,6 +362,106 @@ func (r *Result) AsError() error {
return errors.CompositeValidationError(r.Errors...)
}
+// Reset clears this result so it may be reused, keeping allocated capacity.
+//
+// It implements the hook the pool calls when a result is borrowed and when it
+// is redeemed. Calling it on a result still in use loses its findings.
+func (r *Result) Reset() {
+ _ = r.cleared()
+}
+
+// addErrorsAt adds errors located at the given path.
+func (r *Result) addErrorsAt(at pathSegments, errors ...error) {
+ r.addLocatedErrors(at.pointer(), errors...)
+}
+
+// addWarningsAt adds warnings located at the given path.
+func (r *Result) addWarningsAt(at pathSegments, warnings ...error) {
+ r.addLocatedWarnings(at.pointer(), warnings...)
+}
+
+func (r *Result) addLocatedErrors(pointer string, errors ...error) {
+ for _, e := range errors {
+ if e == nil {
+ continue
+ }
+
+ if isReportedError(r.Errors, e) {
+ continue
+ }
+
+ r.Errors = append(r.Errors, e)
+ r.errorLocations = appendLocation(r.errorLocations, len(r.Errors), pointer)
+ }
+}
+
+func (r *Result) addLocatedWarnings(pointer string, warnings ...error) {
+ for _, e := range warnings {
+ if e == nil {
+ continue
+ }
+
+ if isReportedError(r.Warnings, e) {
+ continue
+ }
+
+ r.Warnings = append(r.Warnings, e)
+ r.warningLocations = appendLocation(r.warningLocations, len(r.Warnings), pointer)
+ }
+}
+
+// relocate rewrites every location this result recorded.
+//
+// The parameter and header validators are the ones a generated client uses at
+// runtime, so they locate a finding by the name of the parameter or header it
+// concerns: a name is all the caller has. When spec validation borrows them to
+// check a default or an example, that name addresses nothing in the document,
+// and the value's own node is the best location available for everything the
+// borrowed validator found.
+func (r *Result) relocate(at pathSegments) {
+ if r == nil {
+ return
+ }
+
+ pointer := at.pointer()
+ r.errorLocations = fillLocations(r.errorLocations[:0], len(r.Errors), pointer)
+ r.warningLocations = fillLocations(r.warningLocations[:0], len(r.Warnings), pointer)
+}
+
+// fillLocations records the same location for a whole run of findings.
+func fillLocations(locations []string, count int, pointer string) []string {
+ for range count {
+ locations = append(locations, pointer)
+ }
+
+ return locations
+}
+
+// redirect rewrites every location this result recorded with the given mapping.
+func (r *Result) redirect(through func(string) string) {
+ for i, pointer := range r.errorLocations {
+ r.errorLocations[i] = through(pointer)
+ }
+ for i, pointer := range r.warningLocations {
+ r.warningLocations[i] = through(pointer)
+ }
+}
+
+// carryErrors adds errors from another result as errors, one by one, so that
+// each keeps the location that result recorded for it.
+func (r *Result) carryErrors(errs []error, locations []string) {
+ for i, e := range errs {
+ r.addLocatedErrors(locationAt(locations, i), e)
+ }
+}
+
+// carryWarnings adds errors from another result as warnings, keeping locations.
+func (r *Result) carryWarnings(errs []error, locations []string) {
+ for i, e := range errs {
+ r.addLocatedWarnings(locationAt(locations, i), e)
+ }
+}
+
func (r *Result) resetCaches() {
r.cachedFieldSchemata = nil
r.cachedItemSchemata = nil
@@ -324,7 +488,7 @@ func (r *Result) mergeForField(obj map[string]any, field string, other *Result)
})
}
if other.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(other)
+ redeemResult(other)
}
return r
@@ -352,7 +516,7 @@ func (r *Result) mergeForSlice(slice reflect.Value, i int, other *Result) *Resul
}
if other.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(other)
+ redeemResult(other)
}
return r
@@ -391,8 +555,8 @@ func (r *Result) addSliceSchemata(slice reflect.Value, i int, schema *spec.Schem
// mergeWithoutRootSchemata merges other into r, ignoring the rootObject schemata.
func (r *Result) mergeWithoutRootSchemata(other *Result) {
r.resetCaches()
- r.AddErrors(other.Errors...)
- r.AddWarnings(other.Warnings...)
+ r.carryErrors(other.Errors, other.errorLocations)
+ r.carryWarnings(other.Warnings, other.warningLocations)
r.MatchCount += other.MatchCount
if other.fieldSchemata != nil {
@@ -438,32 +602,40 @@ func (r *Result) keepRelevantErrors() *Result {
// codes would require to change a lot here. So, for the moment, let's go with
// placeholders.
strippedErrors := []error{}
- for _, e := range r.Errors {
+ strippedErrorLocations := []string{}
+ for i, e := range r.Errors {
if isImportant(e) {
strippedErrors = append(strippedErrors, stripImportantTag(e))
+ strippedErrorLocations = append(strippedErrorLocations, locationAt(r.errorLocations, i))
}
}
strippedWarnings := []error{}
- for _, e := range r.Warnings {
+ strippedWarningLocations := []string{}
+ for i, e := range r.Warnings {
if isImportant(e) {
strippedWarnings = append(strippedWarnings, stripImportantTag(e))
+ strippedWarningLocations = append(strippedWarningLocations, locationAt(r.warningLocations, i))
}
}
var strippedResult *Result
if r.wantsRedeemOnMerge {
- strippedResult = pools.poolOfResults.BorrowResult()
+ strippedResult = validatorPools.results.Borrow()
} else {
strippedResult = new(Result)
}
strippedResult.Errors = strippedErrors
+ strippedResult.errorLocations = strippedErrorLocations
strippedResult.Warnings = strippedWarnings
+ strippedResult.warningLocations = strippedWarningLocations
return strippedResult
}
func (r *Result) cleared() *Result {
// clear the Result to be reusable. Keep allocated capacity.
r.Errors = r.Errors[:0]
+ r.errorLocations = r.errorLocations[:0]
r.Warnings = r.Warnings[:0]
+ r.warningLocations = r.warningLocations[:0]
r.MatchCount = 0
r.data = nil
r.rootObjectSchemata.one = nil
diff --git a/vendor/github.com/go-openapi/validate/schema.go b/vendor/github.com/go-openapi/validate/schema.go
index b72a47bc33..e7af892c74 100644
--- a/vendor/github.com/go-openapi/validate/schema.go
+++ b/vendor/github.com/go-openapi/validate/schema.go
@@ -15,7 +15,17 @@ import (
// SchemaValidator validates data against a JSON schema.
type SchemaValidator struct {
- Path string
+ // Path is the location of the validated value, in the legacy dot-separated
+ // notation. It is what surfaces as the name of a validation error.
+ //
+ // Deprecated: a dotted path is ambiguous whenever a property name contains
+ // a dot. Prefer the JSON pointer rendering of the same location.
+ Path string
+
+ // path is the same location, kept as JSON pointer reference tokens so that
+ // children may be derived from it unambiguously.
+ path pathSegments
+
in string
Schema *spec.Schema
validators [8]valueValidator
@@ -32,7 +42,7 @@ func AgainstSchema(schema *spec.Schema, data any, formats strfmt.Registry, optio
append(options, WithRecycleValidators(true), withRecycleResults(true))...,
).Validate(data)
defer func() {
- pools.poolOfResults.RedeemResult(res)
+ redeemResult(res)
}()
if res.HasErrors() {
@@ -51,10 +61,23 @@ func NewSchemaValidator(schema *spec.Schema, rootSchema any, root string, format
o(opts)
}
- return newSchemaValidator(schema, rootSchema, root, formats, opts)
+ return newSchemaValidator(schema, rootSchema, rootPathFromString(root), formats, opts)
}
-func newSchemaValidator(schema *spec.Schema, rootSchema any, root string, formats strfmt.Registry, opts *SchemaValidatorOptions) *SchemaValidator {
+// rootPathFromString interprets the root path of the exported constructors.
+//
+// The caller hands over an opaque string, so there is no telling which of its
+// dots are separators and which belong to a name: it is taken as a single
+// reference token.
+func rootPathFromString(root string) pathSegments {
+ if root == "" {
+ return rootPath()
+ }
+
+ return newPathSegments(root)
+}
+
+func newSchemaValidator(schema *spec.Schema, rootSchema any, root pathSegments, formats strfmt.Registry, opts *SchemaValidatorOptions) *SchemaValidator {
if schema == nil {
return nil
}
@@ -63,26 +86,27 @@ func newSchemaValidator(schema *spec.Schema, rootSchema any, root string, format
rootSchema = schema
}
+ if opts == nil {
+ opts = new(SchemaValidatorOptions)
+ }
+
if schema.ID != "" || schema.Ref.String() != "" || schema.Ref.IsRoot() {
- err := spec.ExpandSchema(schema, rootSchema, nil)
+ err := spec.ExpandSchemaWithOptions(schema, rootSchema, nil, opts.expandOptions(""))
if err != nil {
msg := invalidSchemaProvidedMsg(err).Error()
panic(msg)
}
}
- if opts == nil {
- opts = new(SchemaValidatorOptions)
- }
-
var s *SchemaValidator
if opts.recycleValidators {
- s = pools.poolOfSchemaValidators.BorrowValidator()
+ s = validatorPools.schemaValidators.Borrow()
} else {
s = new(SchemaValidator)
}
- s.Path = root
+ s.path = root
+ s.Path = root.dotted()
s.in = "body"
s.Schema = schema
s.Root = rootSchema
@@ -104,8 +128,11 @@ func newSchemaValidator(schema *spec.Schema, rootSchema any, root string, format
}
// SetPath sets the path for this schema validator.
+//
+// Note that the sub-validators are built when the validator is created, so
+// this only affects errors reported by this validator, not by its children.
func (s *SchemaValidator) SetPath(path string) {
- s.Path = path
+ s.setPath(rootPathFromString(path))
}
// Applies returns true when this schema validator applies.
@@ -131,7 +158,7 @@ func (s *SchemaValidator) Validate(data any) *Result {
var result *Result
if s.Options.recycleResult {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
result.data = data
} else {
result = &Result{data: data}
@@ -169,7 +196,7 @@ func (s *SchemaValidator) Validate(data any) *Result {
// to map[string]interface{}.
var dd any
if err := jsonutils.FromDynamicJSON(data, &dd); err != nil {
- result.AddErrors(err)
+ result.addErrorsAt(s.path, err)
result.Inc()
return result
@@ -185,7 +212,7 @@ func (s *SchemaValidator) Validate(data any) *Result {
if s.Schema.Type.Contains(integerType) { // avoid lossy conversion
in, erri := num.Int64()
if erri != nil {
- result.AddErrors(invalidTypeConversionMsg(s.Path, erri))
+ result.addErrorsAt(s.path, invalidTypeConversionMsg(s.Path, erri))
result.Inc()
return result
@@ -194,7 +221,7 @@ func (s *SchemaValidator) Validate(data any) *Result {
} else {
nf, errf := num.Float64()
if errf != nil {
- result.AddErrors(invalidTypeConversionMsg(s.Path, errf))
+ result.addErrorsAt(s.path, invalidTypeConversionMsg(s.Path, errf))
result.Inc()
return result
@@ -235,7 +262,7 @@ func (s *SchemaValidator) Validate(data any) *Result {
func (s *SchemaValidator) typeValidator() valueValidator {
return newTypeValidator(
- s.Path,
+ s.path,
s.in,
s.Schema.Type,
s.Schema.Nullable,
@@ -246,7 +273,7 @@ func (s *SchemaValidator) typeValidator() valueValidator {
func (s *SchemaValidator) commonValidator() valueValidator {
return newBasicCommonValidator(
- s.Path,
+ s.path,
s.in,
s.Schema.Default,
s.Schema.Enum,
@@ -256,7 +283,7 @@ func (s *SchemaValidator) commonValidator() valueValidator {
func (s *SchemaValidator) sliceValidator() valueValidator {
return newSliceValidator(
- s.Path,
+ s.path,
s.in,
s.Schema.MaxItems,
s.Schema.MinItems,
@@ -271,7 +298,7 @@ func (s *SchemaValidator) sliceValidator() valueValidator {
func (s *SchemaValidator) numberValidator() valueValidator {
return newNumberValidator(
- s.Path,
+ s.path,
s.in,
s.Schema.Default,
s.Schema.MultipleOf,
@@ -287,7 +314,7 @@ func (s *SchemaValidator) numberValidator() valueValidator {
func (s *SchemaValidator) stringValidator() valueValidator {
return newStringValidator(
- s.Path,
+ s.path,
s.in,
nil,
false,
@@ -301,7 +328,7 @@ func (s *SchemaValidator) stringValidator() valueValidator {
func (s *SchemaValidator) formatValidator() valueValidator {
return newFormatValidator(
- s.Path,
+ s.path,
s.in,
s.Schema.Format,
s.KnownFormats,
@@ -312,14 +339,14 @@ func (s *SchemaValidator) formatValidator() valueValidator {
func (s *SchemaValidator) schemaPropsValidator() valueValidator {
sch := s.Schema
return newSchemaPropsValidator(
- s.Path, s.in, sch.AllOf, sch.OneOf, sch.AnyOf, sch.Not, sch.Dependencies, s.Root, s.KnownFormats,
+ s.path, s.in, sch.AllOf, sch.OneOf, sch.AnyOf, sch.Not, sch.Dependencies, s.Root, s.KnownFormats,
s.Options,
)
}
func (s *SchemaValidator) objectValidator() valueValidator {
return newObjectValidator(
- s.Path,
+ s.path,
s.in,
s.Schema.MaxProperties,
s.Schema.MinProperties,
@@ -333,8 +360,13 @@ func (s *SchemaValidator) objectValidator() valueValidator {
)
}
+func (s *SchemaValidator) setPath(path pathSegments) {
+ s.path = path
+ s.Path = path.dotted()
+}
+
func (s *SchemaValidator) redeem() {
- pools.poolOfSchemaValidators.RedeemValidator(s)
+ validatorPools.schemaValidators.Redeem(s)
}
func (s *SchemaValidator) redeemChildren() {
diff --git a/vendor/github.com/go-openapi/validate/schema_option.go b/vendor/github.com/go-openapi/validate/schema_option.go
index 3e1b882ed3..3ca489c0f5 100644
--- a/vendor/github.com/go-openapi/validate/schema_option.go
+++ b/vendor/github.com/go-openapi/validate/schema_option.go
@@ -3,6 +3,13 @@
package validate
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/spec"
+ "github.com/go-openapi/swag/loading"
+)
+
// SchemaValidatorOptions defines optional rules for schema validation.
type SchemaValidatorOptions struct {
EnableObjectArrayTypeCheck bool
@@ -10,6 +17,7 @@ type SchemaValidatorOptions struct {
recycleValidators bool
recycleResult bool
skipSchemataResult bool
+ pathLoaderWithOptions func(string, ...loading.Option) (json.RawMessage, error)
}
// Option sets optional rules for schema validation.
@@ -60,6 +68,23 @@ func WithSkipSchemataResult(enable bool) Option {
}
}
+// WithPathLoader injects the document loader used to resolve remote and relative $ref while
+// validating a schema or specification. It matches the option-aware loader signature of
+// github.com/go-openapi/swag/loading (and go-openapi/loads).
+//
+// This lets validation resolve references through a caller-provided loader instead of the spec
+// package's global default. The loader may carry any loading options — a custom HTTP client or
+// timeout, authentication or custom headers, an embedded or rooted file system, and so on.
+//
+// One important use is confining loading of untrusted input: build the loader with loading.WithRoot
+// (to confine local reads) and loading.WithHTTPClient (to restrict remote fetches), or use a
+// restricted loader from go-openapi/loads. Left unset, the spec package default loader is used.
+func WithPathLoader(loader func(string, ...loading.Option) (json.RawMessage, error)) Option {
+ return func(svo *SchemaValidatorOptions) {
+ svo.pathLoaderWithOptions = loader
+ }
+}
+
// Options returns the current set of options.
func (svo SchemaValidatorOptions) Options() []Option {
return []Option{
@@ -68,5 +93,17 @@ func (svo SchemaValidatorOptions) Options() []Option {
WithRecycleValidators(svo.recycleValidators),
withRecycleResults(svo.recycleResult),
WithSkipSchemataResult(svo.skipSchemataResult),
+ WithPathLoader(svo.pathLoaderWithOptions),
+ }
+}
+
+// expandOptions builds the spec expand options for schema/$ref expansion during validation,
+// carrying the injected loader (when set) so resolution can be confined. relativeBase is used for
+// base-path-relative resolution; it is ignored by [spec.ExpandSchemaWithOptions], which derives the
+// base from the root.
+func (svo *SchemaValidatorOptions) expandOptions(relativeBase string) *spec.ExpandOptions {
+ return &spec.ExpandOptions{
+ RelativeBase: relativeBase,
+ PathLoaderWithOptions: svo.pathLoaderWithOptions,
}
}
diff --git a/vendor/github.com/go-openapi/validate/schema_props.go b/vendor/github.com/go-openapi/validate/schema_props.go
index 2c4354d08a..d7ecb14ce0 100644
--- a/vendor/github.com/go-openapi/validate/schema_props.go
+++ b/vendor/github.com/go-openapi/validate/schema_props.go
@@ -12,7 +12,7 @@ import (
)
type schemaPropsValidator struct {
- Path string
+ Path pathSegments
In string
AllOf []spec.Schema
OneOf []spec.Schema
@@ -28,12 +28,8 @@ type schemaPropsValidator struct {
Options *SchemaValidatorOptions
}
-func (s *schemaPropsValidator) SetPath(path string) {
- s.Path = path
-}
-
func newSchemaPropsValidator(
- path string, in string, allOf, oneOf, anyOf []spec.Schema, not *spec.Schema, deps spec.Dependencies, root any, formats strfmt.Registry,
+ path pathSegments, in string, allOf, oneOf, anyOf []spec.Schema, not *spec.Schema, deps spec.Dependencies, root any, formats strfmt.Registry,
opts *SchemaValidatorOptions,
) *schemaPropsValidator {
if opts == nil {
@@ -60,7 +56,7 @@ func newSchemaPropsValidator(
var s *schemaPropsValidator
if opts.recycleValidators {
- s = pools.poolOfSchemaPropsValidators.BorrowValidator()
+ s = validatorPools.schemaPropsValidators.Borrow()
} else {
s = new(schemaPropsValidator)
}
@@ -91,7 +87,7 @@ func (s *schemaPropsValidator) Applies(source any, _ reflect.Kind) bool {
func (s *schemaPropsValidator) Validate(data any) *Result {
var mainResult *Result
if s.Options.recycleResult {
- mainResult = pools.poolOfResults.BorrowResult()
+ mainResult = validatorPools.results.Borrow()
} else {
mainResult = new(Result)
}
@@ -111,17 +107,17 @@ func (s *schemaPropsValidator) Validate(data any) *Result {
}
if len(s.anyOfValidators) > 0 {
- keepResultAnyOf = pools.poolOfResults.BorrowResult()
+ keepResultAnyOf = validatorPools.results.Borrow()
s.validateAnyOf(data, mainResult, keepResultAnyOf)
}
if len(s.oneOfValidators) > 0 {
- keepResultOneOf = pools.poolOfResults.BorrowResult()
+ keepResultOneOf = validatorPools.results.Borrow()
s.validateOneOf(data, mainResult, keepResultOneOf)
}
if len(s.allOfValidators) > 0 {
- keepResultAllOf = pools.poolOfResults.BorrowResult()
+ keepResultAllOf = validatorPools.results.Borrow()
s.validateAllOf(data, mainResult, keepResultAllOf)
}
@@ -154,7 +150,7 @@ func (s *schemaPropsValidator) validateAnyOf(data any, mainResult, keepResultAny
if result.IsValid() {
if bestFailures != nil && bestFailures.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(bestFailures)
+ redeemResult(bestFailures)
}
_ = keepResultAnyOf.cleared()
@@ -166,7 +162,7 @@ func (s *schemaPropsValidator) validateAnyOf(data any, mainResult, keepResultAny
// MatchCount is used to select errors from the schema with most positive checks
if bestFailures == nil || result.MatchCount > bestFailures.MatchCount {
if bestFailures != nil && bestFailures.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(bestFailures)
+ redeemResult(bestFailures)
}
bestFailures = result
@@ -174,11 +170,11 @@ func (s *schemaPropsValidator) validateAnyOf(data any, mainResult, keepResultAny
}
if result.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(result) // this result is ditched
+ redeemResult(result) // this result is ditched
}
}
- mainResult.AddErrors(mustValidateAtLeastOneSchemaMsg(s.Path))
+ mainResult.addErrorsAt(s.Path, mustValidateAtLeastOneSchemaMsg(s.Path.dotted()))
mainResult.Merge(bestFailures)
}
@@ -205,7 +201,7 @@ func (s *schemaPropsValidator) validateOneOf(data any, mainResult, keepResultOne
if firstSuccess == nil {
firstSuccess = result
} else if result.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(result) // this result is ditched
+ redeemResult(result) // this result is ditched
}
continue
@@ -214,29 +210,29 @@ func (s *schemaPropsValidator) validateOneOf(data any, mainResult, keepResultOne
// MatchCount is used to select errors from the schema with most positive checks
if validated == 0 && (bestFailures == nil || result.MatchCount > bestFailures.MatchCount) {
if bestFailures != nil && bestFailures.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(bestFailures)
+ redeemResult(bestFailures)
}
bestFailures = result
} else if result.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(result) // this result is ditched
+ redeemResult(result) // this result is ditched
}
}
switch validated {
case 0:
- mainResult.AddErrors(mustValidateOnlyOneSchemaMsg(s.Path, "Found none valid"))
+ mainResult.addErrorsAt(s.Path, mustValidateOnlyOneSchemaMsg(s.Path.dotted(), "Found none valid"))
mainResult.Merge(bestFailures)
// firstSucess necessarily nil
case 1:
mainResult.Merge(firstSuccess)
if bestFailures != nil && bestFailures.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(bestFailures)
+ redeemResult(bestFailures)
}
default:
- mainResult.AddErrors(mustValidateOnlyOneSchemaMsg(s.Path, fmt.Sprintf("Found %d valid alternatives", validated)))
+ mainResult.addErrorsAt(s.Path, mustValidateOnlyOneSchemaMsg(s.Path.dotted(), fmt.Sprintf("Found %d valid alternatives", validated)))
mainResult.Merge(bestFailures)
if firstSuccess != nil && firstSuccess.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(firstSuccess)
+ redeemResult(firstSuccess)
}
}
}
@@ -260,10 +256,10 @@ func (s *schemaPropsValidator) validateAllOf(data any, mainResult, keepResultAll
switch validated {
case 0:
- mainResult.AddErrors(mustValidateAllSchemasMsg(s.Path, ". None validated"))
+ mainResult.addErrorsAt(s.Path, mustValidateAllSchemasMsg(s.Path.dotted(), ". None validated"))
case len(s.allOfValidators):
default:
- mainResult.AddErrors(mustValidateAllSchemasMsg(s.Path, ""))
+ mainResult.addErrorsAt(s.Path, mustValidateAllSchemasMsg(s.Path.dotted(), ""))
}
}
@@ -274,16 +270,16 @@ func (s *schemaPropsValidator) validateNot(data any, mainResult *Result) {
}
// We keep inner IMPORTANT! errors no matter what MatchCount tells us
if result.IsValid() {
- mainResult.AddErrors(mustNotValidatechemaMsg(s.Path))
+ mainResult.addErrorsAt(s.Path, mustNotValidatechemaMsg(s.Path.dotted()))
}
if result.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(result) // this result is ditched
+ redeemResult(result) // this result is ditched
}
}
func (s *schemaPropsValidator) validateDependencies(data any, mainResult *Result) {
val := data.(map[string]any) //nolint:forcetypeassert // caller guarantees map[string]any
- for key := range val {
+ for _, key := range sortedKeys(val) {
dep, ok := s.Dependencies[key]
if !ok {
continue
@@ -291,7 +287,7 @@ func (s *schemaPropsValidator) validateDependencies(data any, mainResult *Result
if dep.Schema != nil {
mainResult.Merge(
- newSchemaValidator(dep.Schema, s.Root, s.Path+"."+key, s.KnownFormats, s.Options).Validate(data),
+ newSchemaValidator(dep.Schema, s.Root, s.Path.child(key), s.KnownFormats, s.Options).Validate(data),
)
continue
}
@@ -299,15 +295,19 @@ func (s *schemaPropsValidator) validateDependencies(data any, mainResult *Result
if len(dep.Property) > 0 {
for _, depKey := range dep.Property {
if _, ok := val[depKey]; !ok {
- mainResult.AddErrors(hasADependencyMsg(s.Path, depKey))
+ mainResult.addErrorsAt(s.Path, hasADependencyMsg(s.Path.dotted(), depKey))
}
}
}
}
}
+func (s *schemaPropsValidator) setPath(path pathSegments) {
+ s.Path = path
+}
+
func (s *schemaPropsValidator) redeem() {
- pools.poolOfSchemaPropsValidators.RedeemValidator(s)
+ validatorPools.schemaPropsValidators.Redeem(s)
}
func (s *schemaPropsValidator) redeemChildren() {
diff --git a/vendor/github.com/go-openapi/validate/slice_validator.go b/vendor/github.com/go-openapi/validate/slice_validator.go
index 8f49d13707..0a0ee74027 100644
--- a/vendor/github.com/go-openapi/validate/slice_validator.go
+++ b/vendor/github.com/go-openapi/validate/slice_validator.go
@@ -4,7 +4,6 @@
package validate
import (
- "fmt"
"reflect"
"github.com/go-openapi/spec"
@@ -12,7 +11,7 @@ import (
)
type schemaSliceValidator struct {
- Path string
+ Path pathSegments
In string
MaxItems *int64
MinItems *int64
@@ -24,7 +23,7 @@ type schemaSliceValidator struct {
Options *SchemaValidatorOptions
}
-func newSliceValidator(path, in string,
+func newSliceValidator(path pathSegments, in string,
maxItems, minItems *int64, uniqueItems bool,
additionalItems *spec.SchemaOrBool, items *spec.SchemaOrArray,
root any, formats strfmt.Registry, opts *SchemaValidatorOptions,
@@ -35,7 +34,7 @@ func newSliceValidator(path, in string,
var v *schemaSliceValidator
if opts.recycleValidators {
- v = pools.poolOfSliceValidators.BorrowValidator()
+ v = validatorPools.sliceValidators.Borrow()
} else {
v = new(schemaSliceValidator)
}
@@ -54,10 +53,6 @@ func newSliceValidator(path, in string,
return v
}
-func (s *schemaSliceValidator) SetPath(path string) {
- s.Path = path
-}
-
func (s *schemaSliceValidator) Applies(source any, kind reflect.Kind) bool {
_, ok := source.(*spec.Schema)
r := ok && kind == reflect.Slice
@@ -73,7 +68,7 @@ func (s *schemaSliceValidator) Validate(data any) *Result {
var result *Result
if s.Options.recycleResult {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
} else {
result = new(Result)
}
@@ -85,8 +80,10 @@ func (s *schemaSliceValidator) Validate(data any) *Result {
if s.Items != nil && s.Items.Schema != nil {
for i := range size {
- validator := newSchemaValidator(s.Items.Schema, s.Root, s.Path, s.KnownFormats, s.Options)
- validator.SetPath(fmt.Sprintf("%s.%d", s.Path, i))
+ // the index has to reach the constructor: the sub-validators that
+ // report the error are built there, and setting the path afterwards
+ // would leave them located on the array rather than on the item.
+ validator := newSchemaValidator(s.Items.Schema, s.Root, s.Path.item(i), s.KnownFormats, s.Options)
value := val.Index(i)
result.mergeForSlice(val, i, validator.Validate(value.Interface()))
}
@@ -100,41 +97,45 @@ func (s *schemaSliceValidator) Validate(data any) *Result {
break
}
- validator := newSchemaValidator(&s.Items.Schemas[i], s.Root, fmt.Sprintf("%s.%d", s.Path, i), s.KnownFormats, s.Options)
+ validator := newSchemaValidator(&s.Items.Schemas[i], s.Root, s.Path.item(i), s.KnownFormats, s.Options)
result.mergeForSlice(val, i, validator.Validate(val.Index(i).Interface()))
}
}
if s.AdditionalItems != nil && itemsSize < size {
if s.Items != nil && len(s.Items.Schemas) > 0 && !s.AdditionalItems.Allows {
- result.AddErrors(arrayDoesNotAllowAdditionalItemsMsg())
+ result.addErrorsAt(s.Path, arrayDoesNotAllowAdditionalItemsMsg())
}
if s.AdditionalItems.Schema != nil {
for i := itemsSize; i < size-itemsSize+1; i++ {
- validator := newSchemaValidator(s.AdditionalItems.Schema, s.Root, fmt.Sprintf("%s.%d", s.Path, i), s.KnownFormats, s.Options)
+ validator := newSchemaValidator(s.AdditionalItems.Schema, s.Root, s.Path.item(i), s.KnownFormats, s.Options)
result.mergeForSlice(val, i, validator.Validate(val.Index(i).Interface()))
}
}
}
if s.MinItems != nil {
- if err := MinItems(s.Path, s.In, int64(size), *s.MinItems); err != nil {
- result.AddErrors(err)
+ if err := MinItems(s.Path.dotted(), s.In, int64(size), *s.MinItems); err != nil {
+ result.addErrorsAt(s.Path, err)
}
}
if s.MaxItems != nil {
- if err := MaxItems(s.Path, s.In, int64(size), *s.MaxItems); err != nil {
- result.AddErrors(err)
+ if err := MaxItems(s.Path.dotted(), s.In, int64(size), *s.MaxItems); err != nil {
+ result.addErrorsAt(s.Path, err)
}
}
if s.UniqueItems {
- if err := UniqueItems(s.Path, s.In, val.Interface()); err != nil {
- result.AddErrors(err)
+ if err := UniqueItems(s.Path.dotted(), s.In, val.Interface()); err != nil {
+ result.addErrorsAt(s.Path, err)
}
}
result.Inc()
return result
}
+func (s *schemaSliceValidator) setPath(path pathSegments) {
+ s.Path = path
+}
+
func (s *schemaSliceValidator) redeem() {
- pools.poolOfSliceValidators.RedeemValidator(s)
+ validatorPools.sliceValidators.Redeem(s)
}
diff --git a/vendor/github.com/go-openapi/validate/sorted.go b/vendor/github.com/go-openapi/validate/sorted.go
new file mode 100644
index 0000000000..829a042c67
--- /dev/null
+++ b/vendor/github.com/go-openapi/validate/sorted.go
@@ -0,0 +1,39 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package validate
+
+import (
+ "cmp"
+ "maps"
+ "slices"
+ "strings"
+
+ "github.com/go-openapi/spec"
+)
+
+// sortedKeys returns the keys of a map in ascending order.
+//
+// Findings are reported in the order the checks walk the document, and several
+// of them walk a map: definitions, paths, response codes, headers, properties.
+// Go randomises map iteration, so the same bytes validated twice would list
+// their findings in a different order — and where a check stops on the first
+// fault it meets, would name a different offender altogether.
+//
+// Walking keys in sorted order makes both defined: findings come out in
+// definition-name (or path, or status-code) order, on every run.
+func sortedKeys[K cmp.Ordered, V any](m map[K]V) []K {
+ return slices.Sorted(maps.Keys(m))
+}
+
+// sortedRefs orders references by the location they point at.
+//
+// The analyzer gathers references in a map, so the slice it hands back comes
+// out in a different order on every run. See [sortedKeys].
+func sortedRefs(refs []spec.Ref) []spec.Ref {
+ slices.SortFunc(refs, func(a, b spec.Ref) int {
+ return strings.Compare(a.String(), b.String())
+ })
+
+ return refs
+}
diff --git a/vendor/github.com/go-openapi/validate/spec.go b/vendor/github.com/go-openapi/validate/spec.go
index 0849e47ea5..e5d16b6793 100644
--- a/vendor/github.com/go-openapi/validate/spec.go
+++ b/vendor/github.com/go-openapi/validate/spec.go
@@ -10,6 +10,7 @@ import (
"fmt"
"slices"
"sort"
+ "strconv"
"strings"
"github.com/go-openapi/analysis"
@@ -25,6 +26,9 @@ import (
//
// Returns an error flattening in a single standard error, all validation messages.
//
+// Options are forwarded to the underlying [SpecValidator]; in particular [WithPathLoader] injects a
+// confined document loader for validating a specification from an untrusted source.
+//
// - Proposal for enhancement: $ref should not have siblings
// - Proposal for enhancement: make sure documentation reflects all checks and warnings
// - Proposal for enhancement: check on discriminators
@@ -35,8 +39,8 @@ import (
// - Proposal for enhancement: check on required properties to support anyOf, allOf, oneOf
//
// NOTE: SecurityScopes are maps: no need to check uniqueness.
-func Spec(doc *loads.Document, formats strfmt.Registry) error {
- errs, _ /*warns*/ := NewSpecValidator(doc.Schema(), formats).Validate(doc)
+func Spec(doc *loads.Document, formats strfmt.Registry, options ...Option) error {
+ errs, _ /*warns*/ := NewSpecValidator(doc.Schema(), formats, options...).Validate(doc)
if errs.HasErrors() {
return errors.CompositeValidationError(errs.Errors...)
}
@@ -45,24 +49,34 @@ func Spec(doc *loads.Document, formats strfmt.Registry) error {
// SpecValidator validates a swagger 2.0 spec.
type SpecValidator struct {
- schema *spec.Schema // swagger 2.0 schema
- spec *loads.Document
- analyzer *analysis.Spec
- expanded *loads.Document
- KnownFormats strfmt.Registry
- Options Opts // validation options
- schemaOptions *SchemaValidatorOptions
+ schema *spec.Schema // swagger 2.0 schema
+ spec *loads.Document
+ analyzer *analysis.Spec
+ expanded *loads.Document
+ refLocations refLocations
+ refRedirects refRedirects
+ paramLocations paramLocations
+ document any // the document as decoded, to tell what it holds
+ KnownFormats strfmt.Registry
+ Options Opts // validation options
+ schemaOptions *SchemaValidatorOptions
}
// NewSpecValidator creates a new swagger spec validator instance.
-func NewSpecValidator(schema *spec.Schema, formats strfmt.Registry) *SpecValidator {
- // schema options that apply to all called validators
+//
+// Options apply to the schema validators used internally. In particular, [WithPathLoader] injects
+// the document loader used to resolve $ref while validating the specification — set a confined
+// loader when validating a specification from an untrusted source (see the package "Security"
+// notes on [WithPathLoader]).
+func NewSpecValidator(schema *spec.Schema, formats strfmt.Registry, options ...Option) *SpecValidator {
+ // schema options that apply to all called validators: built-in defaults first, then
+ // caller-supplied options (which may add a loader or override a default).
schemaOptions := new(SchemaValidatorOptions)
- for _, o := range []Option{
+ for _, o := range append([]Option{
SwaggerSchema(true),
WithRecycleValidators(true),
// withRecycleResults(true),
- } {
+ }, options...) {
o(schemaOptions)
}
@@ -89,6 +103,15 @@ func (s *SpecValidator) Validate(data any) (*Result, *Result) {
}
s.spec = sd
s.analyzer = analysis.New(sd.Spec())
+ // where each $ref sits, as authored: refs are reported against the
+ // unexpanded document, before expansion flattens them away
+ s.refLocations = newRefLocations(s.analyzer)
+ // where each operation declares its parameters: the document addresses
+ // them by index, and expansion loses that
+ s.paramLocations = newParamLocations(sd.Spec())
+ // where each $ref leads: checks walk the expanded document, and a finding
+ // below a $ref has to be brought back to a node the document contains
+ s.refRedirects = newRefRedirects(s.analyzer)
// Raw spec unmarshalling errors
var obj any
@@ -97,16 +120,23 @@ func (s *SpecValidator) Validate(data any) (*Result, *Result) {
// So this one is just a paranoid check on the behavior of the spec package
panic(InvalidDocumentError)
}
+ s.document = obj
defer func() {
+ // bring findings reached through a $ref back onto the document, then
+ // hold every location to what the document actually addresses
+ errs.redirect(s.refRedirects.through)
+ errs.redirect(s.resolvable)
// errs holds all errors and warnings,
// warnings only warnings
errs.MergeAsWarnings(warnings)
- warnings.AddErrors(errs.Warnings...)
+ // reported as errors of the warnings-only result, but keeping the
+ // location each was recorded with
+ warnings.carryErrors(errs.Warnings, errs.warningLocations)
}()
// Swagger schema validator
- schv := newSchemaValidator(s.schema, nil, "", s.KnownFormats, s.schemaOptions)
+ schv := newSchemaValidator(s.schema, nil, rootPath(), s.KnownFormats, s.schemaOptions)
errs.Merge(schv.Validate(obj)) // error -
// There may be a point in continuing to try and determine more accurate errors
if !s.Options.ContinueOnErrors && errs.HasErrors() {
@@ -158,24 +188,25 @@ func (s *SpecValidator) SetContinueOnErrors(c bool) {
}
func (s *SpecValidator) validateNonEmptyPathParamNames() *Result {
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
if s.spec.Spec().Paths == nil {
- // There is no Paths object: error
- res.AddErrors(noValidPathMsg())
+ // There is no Paths object: the document itself is what lacks it, so
+ // there is no node below it to point at
+ res.addErrorsAt(rootPath(), noValidPathMsg())
return res
}
if s.spec.Spec().Paths.Paths == nil {
// Paths may be empty: warning
- res.AddWarnings(noValidPathMsg())
+ res.addWarningsAt(newPathSegments(swaggerPaths), noValidPathMsg())
return res
}
- for k := range s.spec.Spec().Paths.Paths {
+ for _, k := range sortedKeys(s.spec.Spec().Paths.Paths) {
if strings.Contains(k, "{}") {
- res.AddErrors(emptyPathParameterMsg(k))
+ res.addErrorsAt(newPathSegments(swaggerPaths, k), emptyPathParameterMsg(k))
}
}
@@ -192,21 +223,55 @@ func (s *SpecValidator) validateDuplicateOperationIDs() *Result {
// fallback on possible incomplete picture because of previous errors
analyzer = s.analyzer
}
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
+
+ // the message says how many times an identifier is used, so the count is
+ // what it needs; a reader needs somewhere to go, so the first operation to
+ // declare the identifier is remembered along with it
known := make(map[string]int)
- for _, v := range analyzer.OperationIDs() {
- if v != "" {
- known[v]++
+ declaredAt := make(map[string]pathSegments)
+ operations := analyzer.Operations()
+ for _, method := range sortedKeys(operations) {
+ byPath := operations[method]
+ for _, path := range sortedKeys(byPath) {
+ op := byPath[path]
+ id := operationIdentity(method, path, op)
+ known[id]++
+ if _, isKnown := declaredAt[id]; !isKnown {
+ declaredAt[id] = operationIDPath(path, method, op)
+ }
}
}
- for k, v := range known {
- if v > 1 {
- res.AddErrors(nonUniqueOperationIDMsg(k, v))
+
+ for _, k := range sortedKeys(known) {
+ if v := known[k]; v > 1 {
+ res.addErrorsAt(declaredAt[k], nonUniqueOperationIDMsg(k, v))
}
}
return res
}
+// operationIdentity names an operation the way the analyzer does: by its
+// operationId, or by method and path when it declares none.
+func operationIdentity(method, path string, op *spec.Operation) string {
+ if op == nil || op.ID == "" {
+ return strings.ToUpper(method) + " " + path
+ }
+
+ return op.ID
+}
+
+// operationIDPath locates the operationId of an operation, or the operation
+// itself when it declares none.
+func operationIDPath(path, method string, op *spec.Operation) pathSegments {
+ at := operationPath(path, method)
+ if op == nil || op.ID == "" {
+ return at
+ }
+
+ return at.child(swaggerOperationID)
+}
+
type dupProp struct {
Name string
Definition string
@@ -214,8 +279,10 @@ type dupProp struct {
func (s *SpecValidator) validateDuplicatePropertyNames() *Result {
// definition can't declare a property that's already defined by one of its ancestors
- res := pools.poolOfResults.BorrowResult()
- for k, sch := range s.spec.Spec().Definitions {
+ res := validatorPools.results.Borrow()
+ definitions := s.spec.Spec().Definitions
+ for _, k := range sortedKeys(definitions) {
+ sch := definitions[k]
if len(sch.AllOf) == 0 {
continue
}
@@ -229,8 +296,15 @@ func (s *SpecValidator) validateDuplicatePropertyNames() *Result {
res.Merge(rec)
}
if len(ancs) > 0 {
- res.AddErrors(circularAncestryDefinitionMsg(k, ancs))
- return res
+ res.addErrorsAt(newPathSegments(swaggerDefinitions, k), circularAncestryDefinitionMsg(k, ancs))
+ if !s.Options.ContinueOnErrors {
+ return res
+ }
+
+ // the ancestry loops back on itself: searching it for duplicate
+ // property names would not terminate, so this definition stops here
+ // and the next one is examined.
+ continue
}
knowns := make(map[string]struct{})
@@ -243,7 +317,7 @@ func (s *SpecValidator) validateDuplicatePropertyNames() *Result {
for _, v := range dups {
pns = append(pns, v.Definition+"."+v.Name)
}
- res.AddErrors(duplicatePropertiesMsg(k, pns))
+ res.addErrorsAt(newPathSegments(swaggerDefinitions, k), duplicatePropertiesMsg(k, pns))
}
}
@@ -252,7 +326,7 @@ func (s *SpecValidator) validateDuplicatePropertyNames() *Result {
func (s *SpecValidator) resolveRef(ref *spec.Ref) (*spec.Schema, error) {
if s.spec.SpecFilePath() != "" {
- return spec.ResolveRefWithBase(s.spec.Spec(), ref, &spec.ExpandOptions{RelativeBase: s.spec.SpecFilePath()})
+ return spec.ResolveRefWithBase(s.spec.Spec(), ref, s.schemaOptions.expandOptions(s.spec.SpecFilePath()))
}
// NOTE: it looks like with the new spec resolver, this code is now unrecheable
return spec.ResolveRef(s.spec.Spec(), ref)
@@ -263,7 +337,7 @@ func (s *SpecValidator) validateSchemaPropertyNames(nm string, sch spec.Schema,
schn := nm
schc := &sch
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
for schc.Ref.String() != "" {
// gather property names
@@ -287,7 +361,7 @@ func (s *SpecValidator) validateSchemaPropertyNames(nm string, sch spec.Schema,
return dups, res
}
- for k := range schc.Properties {
+ for _, k := range sortedKeys(schc.Properties) {
_, ok := knowns[k]
if ok {
dups = append(dups, dupProp{Name: k, Definition: schn})
@@ -300,7 +374,7 @@ func (s *SpecValidator) validateSchemaPropertyNames(nm string, sch spec.Schema,
}
func (s *SpecValidator) validateCircularAncestry(nm string, sch spec.Schema, knowns map[string]struct{}) ([]string, *Result) {
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
if sch.Ref.String() == "" && len(sch.AllOf) == 0 { // Safeguard. We should not be able to actually get there
return nil, res
@@ -351,14 +425,17 @@ func (s *SpecValidator) validateCircularAncestry(nm string, sch spec.Schema, kno
//nolint:gocognit // refactor in a forthcoming PR
func (s *SpecValidator) validateItems() *Result {
// validate parameter, items, schema and response objects for presence of item if type is array
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
- for method, pi := range s.analyzer.Operations() {
- for path, op := range pi {
+ operations := s.analyzer.Operations()
+ for _, method := range sortedKeys(operations) {
+ pi := operations[method]
+ for _, path := range sortedKeys(pi) {
+ op := pi[path]
for _, param := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) {
if param.TypeName() == arrayType && param.ItemsTypeName() == "" {
- res.AddErrors(arrayInParamRequiresItemsMsg(param.Name, op.ID))
+ res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), arrayInParamRequiresItemsMsg(param.Name, op.ID))
continue
}
if param.In != swaggerBody {
@@ -366,7 +443,7 @@ func (s *SpecValidator) validateItems() *Result {
items := param.Items
for items.TypeName() == arrayType {
if items.ItemsTypeName() == "" {
- res.AddErrors(arrayInParamRequiresItemsMsg(param.Name, op.ID))
+ res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), arrayInParamRequiresItemsMsg(param.Name, op.ID))
break
}
items = items.Items
@@ -375,32 +452,41 @@ func (s *SpecValidator) validateItems() *Result {
} else {
// In: body
if param.Schema != nil {
- res.Merge(s.validateSchemaItems(*param.Schema, fmt.Sprintf("body param %q", param.Name), op.ID))
+ res.Merge(s.validateSchemaItems(*param.Schema, s.parameterPath(path, method, param.In, param.Name).child(jsonSchema),
+ fmt.Sprintf("body param %q", param.Name), op.ID))
}
}
}
- var responses []spec.Response
+ type codedResponse struct {
+ code string
+ resp spec.Response
+ }
+ var responses []codedResponse
if op.Responses != nil {
if op.Responses.Default != nil {
- responses = append(responses, *op.Responses.Default)
+ responses = append(responses, codedResponse{code: jsonDefault, resp: *op.Responses.Default})
}
if op.Responses.StatusCodeResponses != nil {
- for _, v := range op.Responses.StatusCodeResponses {
- responses = append(responses, v)
+ for _, code := range sortedKeys(op.Responses.StatusCodeResponses) {
+ responses = append(responses, codedResponse{
+ code: strconv.Itoa(code),
+ resp: op.Responses.StatusCodeResponses[code],
+ })
}
}
}
for _, resp := range responses {
+ at := responsePath(path, method, resp.code)
// Response headers with array
- for hn, hv := range resp.Headers {
- if hv.TypeName() == arrayType && hv.ItemsTypeName() == "" {
- res.AddErrors(arrayInHeaderRequiresItemsMsg(hn, op.ID))
+ for _, hn := range sortedKeys(resp.resp.Headers) {
+ if hv := resp.resp.Headers[hn]; hv.TypeName() == arrayType && hv.ItemsTypeName() == "" {
+ res.addErrorsAt(at.children(swaggerHeaders, hn), arrayInHeaderRequiresItemsMsg(hn, op.ID))
}
}
- if resp.Schema != nil {
- res.Merge(s.validateSchemaItems(*resp.Schema, "response body", op.ID))
+ if resp.resp.Schema != nil {
+ res.Merge(s.validateSchemaItems(*resp.resp.Schema, at.child(jsonSchema), "response body", op.ID))
}
}
}
@@ -409,24 +495,24 @@ func (s *SpecValidator) validateItems() *Result {
}
// Verifies constraints on array type.
-func (s *SpecValidator) validateSchemaItems(schema spec.Schema, prefix, opID string) *Result {
- res := pools.poolOfResults.BorrowResult()
+func (s *SpecValidator) validateSchemaItems(schema spec.Schema, at pathSegments, prefix, opID string) *Result {
+ res := validatorPools.results.Borrow()
if !schema.Type.Contains(arrayType) {
return res
}
if schema.Items == nil || schema.Items.Len() == 0 {
- res.AddErrors(arrayRequiresItemsMsg(prefix, opID))
+ res.addErrorsAt(at, arrayRequiresItemsMsg(prefix, opID))
return res
}
if schema.Items.Schema != nil {
schema = *schema.Items.Schema
if _, err := compileRegexp(schema.Pattern); err != nil {
- res.AddErrors(invalidItemsPatternMsg(prefix, opID, schema.Pattern))
+ res.addErrorsAt(at, invalidItemsPatternMsg(prefix, opID, schema.Pattern))
}
- res.Merge(s.validateSchemaItems(schema, prefix, opID))
+ res.Merge(s.validateSchemaItems(schema, at.child(jsonItems), prefix, opID))
}
return res
}
@@ -434,7 +520,7 @@ func (s *SpecValidator) validateSchemaItems(schema spec.Schema, prefix, opID str
func (s *SpecValidator) validatePathParamPresence(path string, fromPath, fromOperation []string) *Result {
// Each defined operation path parameters must correspond to a named element in the API's path pattern.
// (For example, you cannot have a path parameter named id for the following path /pets/{petId} but you must have a path parameter named petId.)
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
for _, l := range fromPath {
var matched bool
for _, r := range fromOperation {
@@ -444,7 +530,7 @@ func (s *SpecValidator) validatePathParamPresence(path string, fromPath, fromOpe
}
}
if !matched {
- res.AddErrors(noParameterInPathMsg(l))
+ res.addErrorsAt(newPathSegments(swaggerPaths, path), noParameterInPathMsg(l))
}
}
@@ -454,7 +540,7 @@ func (s *SpecValidator) validatePathParamPresence(path string, fromPath, fromOpe
matched = true
}
if !matched {
- res.AddErrors(pathParamNotInPathMsg(path, p))
+ res.addErrorsAt(newPathSegments(swaggerPaths, path), pathParamNotInPathMsg(path, p))
}
}
@@ -487,9 +573,9 @@ func (s *SpecValidator) validateReferencedParameters() *Result {
if len(expected) == 0 {
return nil
}
- result := pools.poolOfResults.BorrowResult()
- for k := range expected {
- result.AddWarnings(unusedParamMsg(k))
+ result := validatorPools.results.Borrow()
+ for _, k := range sortedKeys(expected) {
+ result.addWarningsAt(localRefPath(k), unusedParamMsg(k))
}
return result
}
@@ -512,10 +598,12 @@ func (s *SpecValidator) validateReferencedResponses() *Result {
if len(expected) == 0 {
return nil
}
- result := pools.poolOfResults.BorrowResult()
- for k := range expected {
- result.AddWarnings(unusedResponseMsg(k))
+
+ result := validatorPools.results.Borrow()
+ for _, k := range sortedKeys(expected) {
+ result.addWarningsAt(localRefPath(k), unusedResponseMsg(k))
}
+
return result
}
@@ -539,59 +627,63 @@ func (s *SpecValidator) validateReferencedDefinitions() *Result {
}
result := new(Result)
- for k := range expected {
- result.AddWarnings(unusedDefinitionMsg(k))
+ for _, k := range sortedKeys(expected) {
+ result.addWarningsAt(localRefPath(k), unusedDefinitionMsg(k))
}
return result
}
func (s *SpecValidator) validateRequiredDefinitions() *Result {
// Each property listed in the required array must be defined in the properties of the model
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
+
+ definitions := s.spec.Spec().Definitions
DEFINITIONS:
- for d, schema := range s.spec.Spec().Definitions {
- if schema.Required != nil { // Safeguard
- for _, pn := range schema.Required {
- red := s.validateRequiredProperties(pn, d, &schema) //#nosec
- // NOTE: capture validity before merging: Merge may redeem `red` to the
- // pool (wantsRedeemOnMerge), after which reading it races with a concurrent
- // BorrowResult().cleared() in another goroutine sharing the global pool.
- isValid := red.IsValid()
- res.Merge(red)
- if !isValid && !s.Options.ContinueOnErrors {
- break DEFINITIONS // there is an error, let's stop that bleeding
- }
- }
+ for _, d := range sortedKeys(definitions) {
+ schema := definitions[d]
+ red := validatorPools.results.Borrow()
+ keepGoing := s.walkRequired(newPathSegments(swaggerDefinitions, d), &schema, red) //#nosec
+ res.Merge(red)
+ if !keepGoing {
+ break DEFINITIONS // there is an error, let's stop that bleeding
}
}
return res
}
-func (s *SpecValidator) validateRequiredProperties(path, in string, v *spec.Schema) *Result {
+// validateRequiredProperties checks one entry of a required array.
+//
+// schemaAt locates the schema being searched for the property, which moves as
+// the search descends into additionalProperties. requiredAt locates the entry
+// of the required array that started it, and stays put.
+func (s *SpecValidator) validateRequiredProperties(
+ path string, of schemaIdentity, schemaAt, requiredAt pathSegments, v *spec.Schema,
+) *Result {
+ in := of.name
// Takes care of recursive property definitions, which may be nested in additionalProperties schemas
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
propertyMatch := false
patternMatch := false
additionalPropertiesMatch := false
isReadOnly := false
- // Regular properties
- if _, ok := v.Properties[path]; ok {
+ // Regular properties, including those a base definition contributes
+ if readOnly, declared := s.declaresProperty(v, path, maxCompositionHops); declared {
propertyMatch = true
- isReadOnly = v.Properties[path].ReadOnly
+ isReadOnly = readOnly
}
// NOTE: patternProperties are not supported in swagger. Even though, we continue validation here
// We check all defined patterns: if one regexp is invalid, croaks an error
- for pp, pv := range v.PatternProperties {
+ for _, pp := range sortedKeys(v.PatternProperties) {
re, err := compileRegexp(pp)
if err != nil {
- res.AddErrors(invalidPatternMsg(pp, in))
+ res.addErrorsAt(schemaAt, invalidPatternMsg(pp, in))
} else if re.MatchString(path) {
patternMatch = true
if !propertyMatch {
- isReadOnly = pv.ReadOnly
+ isReadOnly = v.PatternProperties[pp].ReadOnly
}
}
}
@@ -604,7 +696,7 @@ func (s *SpecValidator) validateRequiredProperties(path, in string, v *spec.Sche
// additionalProperties as schema are upported in swagger
// recursively validates additionalProperties schema
// Proposal for enhancement: anyOf, allOf, oneOf like in schemaPropsValidator
- red := s.validateRequiredProperties(path, in, v.AdditionalProperties.Schema)
+ red := s.validateRequiredProperties(path, of, schemaAt.child(jsonAdditionalProperties), requiredAt, v.AdditionalProperties.Schema)
if red.IsValid() {
additionalPropertiesMatch = true
if !propertyMatch && !patternMatch {
@@ -617,11 +709,11 @@ func (s *SpecValidator) validateRequiredProperties(path, in string, v *spec.Sche
}
if !propertyMatch && !patternMatch && !additionalPropertiesMatch {
- res.AddErrors(requiredButNotDefinedMsg(path, in))
+ res.addErrorsAt(requiredAt, of.requiredButNotDefined(path))
}
if isReadOnly {
- res.AddWarnings(readOnlyAndRequiredMsg(in, path))
+ res.addWarningsAt(requiredAt, readOnlyAndRequiredMsg(in, path))
}
return res
}
@@ -637,26 +729,29 @@ func (s *SpecValidator) validateParameters() *Result {
// - parameters with pattern property must specify valid patterns
// - $ref in parameters must resolve
// - path param must be required
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
rexGarbledPathSegment := mustCompileRegexp(`.*[{}\s]+.*`)
- for method, pi := range s.expandedAnalyzer().Operations() {
+ operations := s.expandedAnalyzer().Operations()
+ for _, method := range sortedKeys(operations) {
+ pi := operations[method]
methodPaths := make(map[string]map[string]string)
- for path, op := range pi {
+ for _, path := range sortedKeys(pi) {
+ op := pi[path]
if s.Options.StrictPathParamUniqueness {
pathToAdd := pathHelp.stripParametersInPath(path)
// Warn on garbled path afer param stripping
if rexGarbledPathSegment.MatchString(pathToAdd) {
- res.AddWarnings(pathStrippedParamGarbledMsg(pathToAdd))
+ res.addWarningsAt(newPathSegments(swaggerPaths, path), pathStrippedParamGarbledMsg(pathToAdd))
}
// Check uniqueness of stripped paths
if _, found := methodPaths[method][pathToAdd]; found {
// Sort names for stable, testable output
if strings.Compare(path, methodPaths[method][pathToAdd]) < 0 {
- res.AddErrors(pathOverlapMsg(path, methodPaths[method][pathToAdd]))
+ res.addErrorsAt(newPathSegments(swaggerPaths, path), pathOverlapMsg(path, methodPaths[method][pathToAdd]))
} else {
- res.AddErrors(pathOverlapMsg(methodPaths[method][pathToAdd], path))
+ res.addErrorsAt(newPathSegments(swaggerPaths, path), pathOverlapMsg(methodPaths[method][pathToAdd], path))
}
} else {
if _, found := methodPaths[method]; !found {
@@ -688,10 +783,10 @@ func (s *SpecValidator) validateParameters() *Result {
for _, pr := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) {
// An expanded parameter must validate the Parameter schema (an unexpanded $ref always passes high-level schema validation)
- schv := newSchemaValidator(¶mSchema, s.schema, fmt.Sprintf("%s.%s.parameters.%s", path, method, pr.Name), s.KnownFormats, s.schemaOptions)
+ schv := newSchemaValidator(¶mSchema, s.schema, s.parameterPath(path, method, pr.In, pr.Name), s.KnownFormats, s.schemaOptions)
var obj any
if err := jsonutils.FromDynamicJSON(pr, &obj); err != nil {
- res.AddErrors(err)
+ res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), err)
return res
}
@@ -700,7 +795,7 @@ func (s *SpecValidator) validateParameters() *Result {
// Validate pattern regexp for parameters with a Pattern property
if _, err := compileRegexp(pr.Pattern); err != nil {
- res.AddErrors(invalidPatternInParamMsg(op.ID, pr.Name, pr.Pattern))
+ res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), invalidPatternInParamMsg(op.ID, pr.Name, pr.Pattern))
}
// There must be at most one parameter in body: list them all
@@ -713,7 +808,7 @@ func (s *SpecValidator) validateParameters() *Result {
paramNames = append(paramNames, pr.Name)
// Path declared in path must have the required: true property
if !pr.Required {
- res.AddErrors(pathParamRequiredMsg(op.ID, pr.Name))
+ res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), pathParamRequiredMsg(op.ID, pr.Name))
}
}
@@ -724,31 +819,31 @@ func (s *SpecValidator) validateParameters() *Result {
if pr.Type != numberType && pr.Type != integerType &&
(pr.Maximum != nil || pr.Minimum != nil || pr.MultipleOf != nil) {
// A non-numeric parameter has validation keywords for numeric instances (number and integer)
- res.AddWarnings(parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type))
+ res.addWarningsAt(s.parameterPath(path, method, pr.In, pr.Name), parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type))
}
if pr.Type != stringType &&
// A non-string parameter has validation keywords for strings
(pr.MaxLength != nil || pr.MinLength != nil || pr.Pattern != "") {
- res.AddWarnings(parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type))
+ res.addWarningsAt(s.parameterPath(path, method, pr.In, pr.Name), parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type))
}
if pr.Type != arrayType &&
// A non-array parameter has validation keywords for arrays
(pr.MaxItems != nil || pr.MinItems != nil || pr.UniqueItems) {
- res.AddWarnings(parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type))
+ res.addWarningsAt(s.parameterPath(path, method, pr.In, pr.Name), parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type))
}
}
// In:formData and In:body are mutually exclusive
if hasBody && hasForm {
- res.AddErrors(bothFormDataAndBodyMsg(op.ID))
+ res.addErrorsAt(operationPath(path, method), bothFormDataAndBodyMsg(op.ID))
}
// There must be at most one body param
// Accurately report situations when more than 1 body param is declared (possibly unnamed)
if len(bodyParams) > 1 {
sort.Strings(bodyParams)
- res.AddErrors(multipleBodyParamMsg(op.ID, bodyParams))
+ res.addErrorsAt(operationPath(path, method), multipleBodyParamMsg(op.ID, bodyParams))
}
// Check uniqueness of parameters in path
@@ -756,7 +851,7 @@ func (s *SpecValidator) validateParameters() *Result {
for i, p := range paramsInPath {
for j, q := range paramsInPath {
if p == q && i > j {
- res.AddErrors(pathParamNotUniqueMsg(path, p, q))
+ res.addErrorsAt(newPathSegments(swaggerPaths, path), pathParamNotUniqueMsg(path, p, q))
break
}
}
@@ -766,7 +861,7 @@ func (s *SpecValidator) validateParameters() *Result {
rexGarbledParam := mustCompileRegexp(`{.*[{}\s]+.*}`)
for _, p := range paramsInPath {
if rexGarbledParam.MatchString(p) {
- res.AddWarnings(pathParamGarbledMsg(path, p))
+ res.addWarningsAt(newPathSegments(swaggerPaths, path), pathParamGarbledMsg(path, p))
}
}
@@ -779,25 +874,63 @@ func (s *SpecValidator) validateParameters() *Result {
func (s *SpecValidator) validateReferencesValid() *Result {
// each reference must point to a valid object
- res := pools.poolOfResults.BorrowResult()
- for _, r := range s.analyzer.AllRefs() {
+ res := validatorPools.results.Borrow()
+ for _, r := range sortedRefs(s.analyzer.AllRefs()) {
if !r.IsValidURI(s.spec.SpecFilePath()) { // Safeguard - spec should always yield a valid URI
- res.AddErrors(invalidRefMsg(r.String()))
+ res.addErrorsAt(s.refLocations.at(r.String()), invalidRefMsg(r.String()))
}
}
if !res.HasErrors() {
// NOTE: with default settings, loads.Document.Expanded()
// stops on first error. Anyhow, the expand option to continue
// on errors fails to report errors at all.
- exp, err := s.spec.Expanded()
+ //
+ // Pass the injected loader (if any) so whole-spec expansion is confined too. When no loader
+ // is set, this is a no-op: loads falls back to the document's own loader.
+ exp, err := s.spec.Expanded(s.schemaOptions.expandOptions(""))
if err != nil {
- res.AddErrors(unresolvedReferencesMsg(err))
+ res.addErrorsAt(s.firstUnresolvableRef(), unresolvedReferencesMsg(err))
}
s.expanded = exp
}
return res
}
+// firstUnresolvableRef locates the declaration of the first local $ref, in
+// document order, that points at a node the document does not hold.
+//
+// Expansion reports the whole document in a single message, naming only the
+// reference it happened to trip on, so the finding has no location of its own.
+// A document usually has one broken reference; when it has several, this is the
+// first one a reader would meet.
+func (s *SpecValidator) firstUnresolvableRef() pathSegments {
+ first := rootPath()
+ found := false
+
+ for _, r := range s.analyzer.AllRefs() {
+ value := r.String()
+ if !strings.HasPrefix(value, "#/") {
+ // a remote reference cannot be checked against the document alone
+ continue
+ }
+
+ pointer, err := jsonpointer.New(strings.TrimPrefix(value, "#"))
+ if err != nil {
+ continue
+ }
+ if _, _, err := pointer.Get(s.document); err == nil {
+ continue
+ }
+
+ at := s.refLocations.at(value)
+ if !found || at.pointer() < first.pointer() {
+ first, found = at, true
+ }
+ }
+
+ return first
+}
+
func (s *SpecValidator) checkUniqueParams(path, method string, op *spec.Operation) *Result {
// Check for duplicate parameters declaration in param section.
// Each parameter should have a unique `name` and `type` combination
@@ -805,7 +938,7 @@ func (s *SpecValidator) checkUniqueParams(path, method string, op *spec.Operatio
// However, there are some issues with such a factorization:
// - analysis does not seem to fully expand params
// - param keys may be altered by x-go-name
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
pnames := make(map[string]struct{})
if op.Parameters != nil { // Safeguard
@@ -818,7 +951,7 @@ func (s *SpecValidator) checkUniqueParams(path, method string, op *spec.Operatio
key := fmt.Sprintf("%s#%s", pr.In, pr.Name)
if _, ok = pnames[key]; ok {
- res.AddErrors(duplicateParamNameMsg(pr.In, pr.Name, op.ID))
+ res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), duplicateParamNameMsg(pr.In, pr.Name, op.ID))
}
pnames[key] = struct{}{}
}
diff --git a/vendor/github.com/go-openapi/validate/spec_messages.go b/vendor/github.com/go-openapi/validate/spec_messages.go
index eeb8a86951..0a0739a75d 100644
--- a/vendor/github.com/go-openapi/validate/spec_messages.go
+++ b/vendor/github.com/go-openapi/validate/spec_messages.go
@@ -132,6 +132,9 @@ const (
// RequiredButNotDefinedError ...
RequiredButNotDefinedError = "%q is present in required but not defined as property in definition %q"
+ // RequiredButNotDefinedInSchemaError is the same slip, in a schema a definition holds rather than
+ // in the definition itself.
+ RequiredButNotDefinedInSchemaError = "%q is present in required but not defined as property in schema %q"
// SomeParametersBrokenError indicates that some parameters could not be resolved, which might result in partial checks to be carried on.
SomeParametersBrokenError = "some parameters definitions are broken in %q.%s. Cannot carry on full checks on parameters for operation %s"
@@ -260,6 +263,10 @@ func requiredButNotDefinedMsg(path, definition string) errors.Error {
return errors.New(errors.CompositeErrorCode, RequiredButNotDefinedError, path, definition)
}
+func requiredButNotDefinedInSchemaMsg(path, schema string) errors.Error {
+ return errors.New(errors.CompositeErrorCode, RequiredButNotDefinedInSchemaError, path, schema)
+}
+
func pathParamGarbledMsg(path, param string) errors.Error {
return errors.New(errors.CompositeErrorCode, PathParamGarbledWarning, path, param)
}
diff --git a/vendor/github.com/go-openapi/validate/spec_ref_warnings.go b/vendor/github.com/go-openapi/validate/spec_ref_warnings.go
index 49c72314c9..d56cb177cc 100644
--- a/vendor/github.com/go-openapi/validate/spec_ref_warnings.go
+++ b/vendor/github.com/go-openapi/validate/spec_ref_warnings.go
@@ -34,12 +34,12 @@ const minDistinctHostsToWarn = 2
//
// All findings are warnings: they do not affect validity (see Result.IsValid).
func (s *SpecValidator) validateDubiousRefs() *Result {
- res := pools.poolOfResults.BorrowResult()
+ res := validatorPools.results.Borrow()
baseDir, hasBase := s.localBaseDir()
remoteHosts := make(map[string]struct{})
- for _, r := range s.analyzer.AllRefs() {
+ for _, r := range sortedRefs(s.analyzer.AllRefs()) {
u := r.GetURL()
if u == nil { // Safeguard: a valid spec always yields parseable refs
continue
@@ -48,7 +48,7 @@ func (s *SpecValidator) validateDubiousRefs() *Result {
// Rule 1: absolute local reference escaping the base path.
if refPath, isLocalAbs := absoluteLocalRefPath(r, u); isLocalAbs {
if !hasBase || !isBeneathBase(refPath, baseDir) {
- res.AddWarnings(dubiousAbsoluteRefMsg(r.String()))
+ res.addWarningsAt(s.refLocations.at(r.String()), dubiousAbsoluteRefMsg(r.String()))
}
continue
}
diff --git a/vendor/github.com/go-openapi/validate/type.go b/vendor/github.com/go-openapi/validate/type.go
index d29574c349..3016783f07 100644
--- a/vendor/github.com/go-openapi/validate/type.go
+++ b/vendor/github.com/go-openapi/validate/type.go
@@ -15,7 +15,7 @@ import (
)
type typeValidator struct {
- Path string
+ Path pathSegments
In string
Type spec.StringOrArray
Nullable bool
@@ -23,14 +23,14 @@ type typeValidator struct {
Options *SchemaValidatorOptions
}
-func newTypeValidator(path, in string, typ spec.StringOrArray, nullable bool, format string, opts *SchemaValidatorOptions) *typeValidator {
+func newTypeValidator(path pathSegments, in string, typ spec.StringOrArray, nullable bool, format string, opts *SchemaValidatorOptions) *typeValidator {
if opts == nil {
opts = new(SchemaValidatorOptions)
}
var t *typeValidator
if opts.recycleValidators {
- t = pools.poolOfTypeValidators.BorrowValidator()
+ t = validatorPools.typeValidators.Borrow()
} else {
t = new(typeValidator)
}
@@ -45,10 +45,6 @@ func newTypeValidator(path, in string, typ spec.StringOrArray, nullable bool, fo
return t
}
-func (t *typeValidator) SetPath(path string) {
- t.Path = path
-}
-
func (t *typeValidator) Applies(source any, _ reflect.Kind) bool {
// typeValidator applies to Schema, Parameter and Header objects
switch source.(type) {
@@ -72,7 +68,7 @@ func (t *typeValidator) Validate(data any) *Result {
if data == nil {
// nil or zero value for the passed structure require Type: null
if len(t.Type) > 0 && !t.Type.Contains(nullType) && !t.Nullable { // NOTE: if a property is not required it also passes this
- return errorHelp.sErr(errors.InvalidType(t.Path, t.In, strings.Join(t.Type, ","), nullType), t.Options.recycleResult)
+ return errorHelp.sErrAt(t.Path, errors.InvalidType(t.Path.dotted(), t.In, strings.Join(t.Type, ","), nullType), t.Options.recycleResult)
}
return emptyResult
@@ -98,7 +94,7 @@ func (t *typeValidator) Validate(data any) *Result {
!isFloatInt && !isIntFloat && !isLowerInt && !isLowerFloat
if formatMismatch {
// NOTE: test case
- return errorHelp.sErr(errors.InvalidType(t.Path, t.In, t.Format, format), t.Options.recycleResult)
+ return errorHelp.sErrAt(t.Path, errors.InvalidType(t.Path.dotted(), t.In, t.Format, format), t.Options.recycleResult)
}
if !t.Type.Contains(numberType) && !t.Type.Contains(integerType) && t.Format != "" && (kind == reflect.String || kind == reflect.Slice) {
@@ -106,7 +102,7 @@ func (t *typeValidator) Validate(data any) *Result {
}
if !t.Type.Contains(schType) && !isFloatInt && !isIntFloat {
- return errorHelp.sErr(errors.InvalidType(t.Path, t.In, strings.Join(t.Type, ","), schType), t.Options.recycleResult)
+ return errorHelp.sErrAt(t.Path, errors.InvalidType(t.Path.dotted(), t.In, strings.Join(t.Type, ","), schType), t.Options.recycleResult)
}
return emptyResult
@@ -201,6 +197,10 @@ func (t *typeValidator) schemaInfoForType(data any) (string, string) {
return "", ""
}
+func (t *typeValidator) setPath(path pathSegments) {
+ t.Path = path
+}
+
func (t *typeValidator) redeem() {
- pools.poolOfTypeValidators.RedeemValidator(t)
+ validatorPools.typeValidators.Redeem(t)
}
diff --git a/vendor/github.com/go-openapi/validate/validator.go b/vendor/github.com/go-openapi/validate/validator.go
index e7aebc5256..3989b21e7d 100644
--- a/vendor/github.com/go-openapi/validate/validator.go
+++ b/vendor/github.com/go-openapi/validate/validator.go
@@ -4,7 +4,6 @@
package validate
import (
- "fmt"
"reflect"
"github.com/go-openapi/errors"
@@ -18,7 +17,7 @@ type EntityValidator interface {
}
type valueValidator interface {
- SetPath(path string)
+ setPath(path pathSegments)
Applies(source any, kind reflect.Kind) bool
Validate(data any) *Result
}
@@ -26,21 +25,21 @@ type valueValidator interface {
type itemsValidator struct {
items *spec.Items
root any
- path string
+ path pathSegments
in string
validators [6]valueValidator
KnownFormats strfmt.Registry
Options *SchemaValidatorOptions
}
-func newItemsValidator(path, in string, items *spec.Items, root any, formats strfmt.Registry, opts *SchemaValidatorOptions) *itemsValidator {
+func newItemsValidator(path pathSegments, in string, items *spec.Items, root any, formats strfmt.Registry, opts *SchemaValidatorOptions) *itemsValidator {
if opts == nil {
opts = new(SchemaValidatorOptions)
}
var iv *itemsValidator
if opts.recycleValidators {
- iv = pools.poolOfItemsValidators.BorrowValidator()
+ iv = validatorPools.itemsValidators.Borrow()
} else {
iv = new(itemsValidator)
}
@@ -74,12 +73,12 @@ func (i *itemsValidator) Validate(index int, data any) *Result {
kind := tpe.Kind()
var result *Result
if i.Options.recycleResult {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
} else {
result = new(Result)
}
- path := fmt.Sprintf("%s.%d", i.path, index)
+ path := i.path.item(index)
for idx, validator := range i.validators {
if !validator.Applies(i.root, kind) {
@@ -97,7 +96,7 @@ func (i *itemsValidator) Validate(index int, data any) *Result {
continue
}
- validator.SetPath(path)
+ validator.setPath(path)
err := validator.Validate(data)
if i.Options.recycleValidators {
i.validators[idx] = nil // prevents further (unsafe) usage
@@ -130,7 +129,7 @@ func (i *itemsValidator) typeValidator() valueValidator {
func (i *itemsValidator) commonValidator() valueValidator {
return newBasicCommonValidator(
- "",
+ nil, // located by the item index, set on each Validate call
i.in,
i.items.Default,
i.items.Enum,
@@ -140,7 +139,7 @@ func (i *itemsValidator) commonValidator() valueValidator {
func (i *itemsValidator) sliceValidator() valueValidator {
return newBasicSliceValidator(
- "",
+ nil, // located by the item index, set on each Validate call
i.in,
i.items.Default,
i.items.MaxItems,
@@ -155,7 +154,7 @@ func (i *itemsValidator) sliceValidator() valueValidator {
func (i *itemsValidator) numberValidator() valueValidator {
return newNumberValidator(
- "",
+ nil, // located by the item index, set on each Validate call
i.in,
i.items.Default,
i.items.MultipleOf,
@@ -171,7 +170,7 @@ func (i *itemsValidator) numberValidator() valueValidator {
func (i *itemsValidator) stringValidator() valueValidator {
return newStringValidator(
- "",
+ nil, // located by the item index, set on each Validate call
i.in,
i.items.Default,
false, // Required
@@ -185,7 +184,7 @@ func (i *itemsValidator) stringValidator() valueValidator {
func (i *itemsValidator) formatValidator() valueValidator {
return newFormatValidator(
- "",
+ nil, // located by the item index, set on each Validate call
i.in,
i.items.Format,
i.KnownFormats,
@@ -194,7 +193,7 @@ func (i *itemsValidator) formatValidator() valueValidator {
}
func (i *itemsValidator) redeem() {
- pools.poolOfItemsValidators.RedeemValidator(i)
+ validatorPools.itemsValidators.Redeem(i)
}
func (i *itemsValidator) redeemChildren() {
@@ -213,21 +212,21 @@ func (i *itemsValidator) redeemChildren() {
}
type basicCommonValidator struct {
- Path string
+ Path pathSegments
In string
Default any
Enum []any
Options *SchemaValidatorOptions
}
-func newBasicCommonValidator(path, in string, def any, enum []any, opts *SchemaValidatorOptions) *basicCommonValidator {
+func newBasicCommonValidator(path pathSegments, in string, def any, enum []any, opts *SchemaValidatorOptions) *basicCommonValidator {
if opts == nil {
opts = new(SchemaValidatorOptions)
}
var b *basicCommonValidator
if opts.recycleValidators {
- b = pools.poolOfBasicCommonValidators.BorrowValidator()
+ b = validatorPools.basicCommonValidators.Borrow()
} else {
b = new(basicCommonValidator)
}
@@ -241,10 +240,6 @@ func newBasicCommonValidator(path, in string, def any, enum []any, opts *SchemaV
return b
}
-func (b *basicCommonValidator) SetPath(path string) {
- b.Path = path
-}
-
func (b *basicCommonValidator) Applies(source any, _ reflect.Kind) bool {
switch source.(type) {
case *spec.Parameter, *spec.Schema, *spec.Header:
@@ -279,11 +274,15 @@ func (b *basicCommonValidator) Validate(data any) (res *Result) {
}
}
- return errorHelp.sErr(errors.EnumFail(b.Path, b.In, data, b.Enum), b.Options.recycleResult)
+ return errorHelp.sErrAt(b.Path, errors.EnumFail(b.Path.dotted(), b.In, data, b.Enum), b.Options.recycleResult)
+}
+
+func (b *basicCommonValidator) setPath(path pathSegments) {
+ b.Path = path
}
func (b *basicCommonValidator) redeem() {
- pools.poolOfBasicCommonValidators.RedeemValidator(b)
+ validatorPools.basicCommonValidators.Redeem(b)
}
// A HeaderValidator has very limited subset of validations to apply.
@@ -312,7 +311,7 @@ func newHeaderValidator(name string, header *spec.Header, formats strfmt.Registr
var p *HeaderValidator
if opts.recycleValidators {
- p = pools.poolOfHeaderValidators.BorrowValidator()
+ p = validatorPools.headerValidators.Borrow()
} else {
p = new(HeaderValidator)
}
@@ -323,7 +322,7 @@ func newHeaderValidator(name string, header *spec.Header, formats strfmt.Registr
p.Options = opts
p.validators = [6]valueValidator{
newTypeValidator(
- name,
+ newPathSegments(name),
"header",
spec.StringOrArray([]string{header.Type}),
header.Nullable,
@@ -355,7 +354,7 @@ func (p *HeaderValidator) Validate(data any) *Result {
var result *Result
if p.Options.recycleResult {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
} else {
result = new(Result)
}
@@ -397,7 +396,7 @@ func (p *HeaderValidator) Validate(data any) *Result {
func (p *HeaderValidator) commonValidator() valueValidator {
return newBasicCommonValidator(
- p.name,
+ newPathSegments(p.name),
"response",
p.header.Default,
p.header.Enum,
@@ -407,7 +406,7 @@ func (p *HeaderValidator) commonValidator() valueValidator {
func (p *HeaderValidator) sliceValidator() valueValidator {
return newBasicSliceValidator(
- p.name,
+ newPathSegments(p.name),
"response",
p.header.Default,
p.header.MaxItems,
@@ -422,7 +421,7 @@ func (p *HeaderValidator) sliceValidator() valueValidator {
func (p *HeaderValidator) numberValidator() valueValidator {
return newNumberValidator(
- p.name,
+ newPathSegments(p.name),
"response",
p.header.Default,
p.header.MultipleOf,
@@ -438,7 +437,7 @@ func (p *HeaderValidator) numberValidator() valueValidator {
func (p *HeaderValidator) stringValidator() valueValidator {
return newStringValidator(
- p.name,
+ newPathSegments(p.name),
"response",
p.header.Default,
true,
@@ -452,7 +451,7 @@ func (p *HeaderValidator) stringValidator() valueValidator {
func (p *HeaderValidator) formatValidator() valueValidator {
return newFormatValidator(
- p.name,
+ newPathSegments(p.name),
"response",
p.header.Format,
p.KnownFormats,
@@ -461,7 +460,7 @@ func (p *HeaderValidator) formatValidator() valueValidator {
}
func (p *HeaderValidator) redeem() {
- pools.poolOfHeaderValidators.RedeemValidator(p)
+ validatorPools.headerValidators.Redeem(p)
}
func (p *HeaderValidator) redeemChildren() {
@@ -504,7 +503,7 @@ func newParamValidator(param *spec.Parameter, formats strfmt.Registry, opts *Sch
var p *ParamValidator
if opts.recycleValidators {
- p = pools.poolOfParamValidators.BorrowValidator()
+ p = validatorPools.paramValidators.Borrow()
} else {
p = new(ParamValidator)
}
@@ -514,7 +513,7 @@ func newParamValidator(param *spec.Parameter, formats strfmt.Registry, opts *Sch
p.Options = opts
p.validators = [6]valueValidator{
newTypeValidator(
- param.Name,
+ newPathSegments(param.Name),
param.In,
spec.StringOrArray([]string{param.Type}),
param.Nullable,
@@ -539,7 +538,7 @@ func (p *ParamValidator) Validate(data any) *Result {
var result *Result
if p.Options.recycleResult {
- result = pools.poolOfResults.BorrowResult()
+ result = validatorPools.results.Borrow()
} else {
result = new(Result)
}
@@ -589,7 +588,7 @@ func (p *ParamValidator) Validate(data any) *Result {
func (p *ParamValidator) commonValidator() valueValidator {
return newBasicCommonValidator(
- p.param.Name,
+ newPathSegments(p.param.Name),
p.param.In,
p.param.Default,
p.param.Enum,
@@ -599,7 +598,7 @@ func (p *ParamValidator) commonValidator() valueValidator {
func (p *ParamValidator) sliceValidator() valueValidator {
return newBasicSliceValidator(
- p.param.Name,
+ newPathSegments(p.param.Name),
p.param.In,
p.param.Default,
p.param.MaxItems,
@@ -614,7 +613,7 @@ func (p *ParamValidator) sliceValidator() valueValidator {
func (p *ParamValidator) numberValidator() valueValidator {
return newNumberValidator(
- p.param.Name,
+ newPathSegments(p.param.Name),
p.param.In,
p.param.Default,
p.param.MultipleOf,
@@ -630,7 +629,7 @@ func (p *ParamValidator) numberValidator() valueValidator {
func (p *ParamValidator) stringValidator() valueValidator {
return newStringValidator(
- p.param.Name,
+ newPathSegments(p.param.Name),
p.param.In,
p.param.Default,
p.param.Required,
@@ -644,7 +643,7 @@ func (p *ParamValidator) stringValidator() valueValidator {
func (p *ParamValidator) formatValidator() valueValidator {
return newFormatValidator(
- p.param.Name,
+ newPathSegments(p.param.Name),
p.param.In,
p.param.Format,
p.KnownFormats,
@@ -653,7 +652,7 @@ func (p *ParamValidator) formatValidator() valueValidator {
}
func (p *ParamValidator) redeem() {
- pools.poolOfParamValidators.RedeemValidator(p)
+ validatorPools.paramValidators.Redeem(p)
}
func (p *ParamValidator) redeemChildren() {
@@ -672,7 +671,7 @@ func (p *ParamValidator) redeemChildren() {
}
type basicSliceValidator struct {
- Path string
+ Path pathSegments
In string
Default any
MaxItems *int64
@@ -685,7 +684,7 @@ type basicSliceValidator struct {
}
func newBasicSliceValidator(
- path, in string,
+ path pathSegments, in string,
def any, maxItems, minItems *int64, uniqueItems bool, items *spec.Items,
source any, formats strfmt.Registry,
opts *SchemaValidatorOptions,
@@ -696,7 +695,7 @@ func newBasicSliceValidator(
var s *basicSliceValidator
if opts.recycleValidators {
- s = pools.poolOfBasicSliceValidators.BorrowValidator()
+ s = validatorPools.basicSliceValidators.Borrow()
} else {
s = new(basicSliceValidator)
}
@@ -715,10 +714,6 @@ func newBasicSliceValidator(
return s
}
-func (s *basicSliceValidator) SetPath(path string) {
- s.Path = path
-}
-
func (s *basicSliceValidator) Applies(source any, kind reflect.Kind) bool {
switch source.(type) {
case *spec.Parameter, *spec.Items, *spec.Header:
@@ -738,20 +733,20 @@ func (s *basicSliceValidator) Validate(data any) *Result {
size := int64(val.Len())
if s.MinItems != nil {
- if err := MinItems(s.Path, s.In, size, *s.MinItems); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := MinItems(s.Path.dotted(), s.In, size, *s.MinItems); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
if s.MaxItems != nil {
- if err := MaxItems(s.Path, s.In, size, *s.MaxItems); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := MaxItems(s.Path.dotted(), s.In, size, *s.MaxItems); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
if s.UniqueItems {
- if err := UniqueItems(s.Path, s.In, data); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := UniqueItems(s.Path.dotted(), s.In, data); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
@@ -767,7 +762,7 @@ func (s *basicSliceValidator) Validate(data any) *Result {
return err
}
if err.wantsRedeemOnMerge {
- pools.poolOfResults.RedeemResult(err)
+ redeemResult(err)
}
}
}
@@ -775,12 +770,16 @@ func (s *basicSliceValidator) Validate(data any) *Result {
return nil
}
+func (s *basicSliceValidator) setPath(path pathSegments) {
+ s.Path = path
+}
+
func (s *basicSliceValidator) redeem() {
- pools.poolOfBasicSliceValidators.RedeemValidator(s)
+ validatorPools.basicSliceValidators.Redeem(s)
}
type numberValidator struct {
- Path string
+ Path pathSegments
In string
Default any
MultipleOf *float64
@@ -795,7 +794,7 @@ type numberValidator struct {
}
func newNumberValidator(
- path, in string, def any,
+ path pathSegments, in string, def any,
multipleOf, maximum *float64, exclusiveMaximum bool, minimum *float64, exclusiveMinimum bool,
typ, format string,
opts *SchemaValidatorOptions,
@@ -806,7 +805,7 @@ func newNumberValidator(
var n *numberValidator
if opts.recycleValidators {
- n = pools.poolOfNumberValidators.BorrowValidator()
+ n = validatorPools.numberValidators.Borrow()
} else {
n = new(numberValidator)
}
@@ -826,10 +825,6 @@ func newNumberValidator(
return n
}
-func (n *numberValidator) SetPath(path string) {
- n.Path = path
-}
-
func (n *numberValidator) Applies(source any, kind reflect.Kind) bool {
switch source.(type) {
case *spec.Parameter, *spec.Schema, *spec.Items, *spec.Header:
@@ -871,7 +866,7 @@ func (n *numberValidator) Validate(val any) *Result {
var res, resMultiple, resMinimum, resMaximum *Result
if n.Options.recycleResult {
- res = pools.poolOfResults.BorrowResult()
+ res = validatorPools.results.Borrow()
} else {
res = new(Result)
}
@@ -881,58 +876,58 @@ func (n *numberValidator) Validate(val any) *Result {
data := valueHelp.asFloat64(val)
// Is the provided value within the range of the specified numeric type and format?
- res.AddErrors(IsValueValidAgainstRange(val, n.Type, n.Format, "Checked", n.Path))
+ res.addErrorsAt(n.Path, IsValueValidAgainstRange(val, n.Type, n.Format, "Checked", n.Path.dotted()))
if n.MultipleOf != nil {
- resMultiple = pools.poolOfResults.BorrowResult()
+ resMultiple = validatorPools.results.Borrow()
// Is the constraint specifier within the range of the specific numeric type and format?
- resMultiple.AddErrors(IsValueValidAgainstRange(*n.MultipleOf, n.Type, n.Format, "MultipleOf", n.Path))
+ resMultiple.addErrorsAt(n.Path, IsValueValidAgainstRange(*n.MultipleOf, n.Type, n.Format, "MultipleOf", n.Path.dotted()))
if resMultiple.IsValid() {
// Constraint validated with compatible types
- if err := MultipleOfNativeType(n.Path, n.In, val, *n.MultipleOf); err != nil {
- resMultiple.Merge(errorHelp.sErr(err, n.Options.recycleResult))
+ if err := MultipleOfNativeType(n.Path.dotted(), n.In, val, *n.MultipleOf); err != nil {
+ resMultiple.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult))
}
} else {
// Constraint nevertheless validated, converted as general number
- if err := MultipleOf(n.Path, n.In, data, *n.MultipleOf); err != nil {
- resMultiple.Merge(errorHelp.sErr(err, n.Options.recycleResult))
+ if err := MultipleOf(n.Path.dotted(), n.In, data, *n.MultipleOf); err != nil {
+ resMultiple.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult))
}
}
}
if n.Maximum != nil {
- resMaximum = pools.poolOfResults.BorrowResult()
+ resMaximum = validatorPools.results.Borrow()
// Is the constraint specifier within the range of the specific numeric type and format?
- resMaximum.AddErrors(IsValueValidAgainstRange(*n.Maximum, n.Type, n.Format, "Maximum boundary", n.Path))
+ resMaximum.addErrorsAt(n.Path, IsValueValidAgainstRange(*n.Maximum, n.Type, n.Format, "Maximum boundary", n.Path.dotted()))
if resMaximum.IsValid() {
// Constraint validated with compatible types
- if err := MaximumNativeType(n.Path, n.In, val, *n.Maximum, n.ExclusiveMaximum); err != nil {
- resMaximum.Merge(errorHelp.sErr(err, n.Options.recycleResult))
+ if err := MaximumNativeType(n.Path.dotted(), n.In, val, *n.Maximum, n.ExclusiveMaximum); err != nil {
+ resMaximum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult))
}
} else {
// Constraint nevertheless validated, converted as general number
- if err := Maximum(n.Path, n.In, data, *n.Maximum, n.ExclusiveMaximum); err != nil {
- resMaximum.Merge(errorHelp.sErr(err, n.Options.recycleResult))
+ if err := Maximum(n.Path.dotted(), n.In, data, *n.Maximum, n.ExclusiveMaximum); err != nil {
+ resMaximum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult))
}
}
}
if n.Minimum != nil {
- resMinimum = pools.poolOfResults.BorrowResult()
+ resMinimum = validatorPools.results.Borrow()
// Is the constraint specifier within the range of the specific numeric type and format?
- resMinimum.AddErrors(IsValueValidAgainstRange(*n.Minimum, n.Type, n.Format, "Minimum boundary", n.Path))
+ resMinimum.addErrorsAt(n.Path, IsValueValidAgainstRange(*n.Minimum, n.Type, n.Format, "Minimum boundary", n.Path.dotted()))
if resMinimum.IsValid() {
// Constraint validated with compatible types
- if err := MinimumNativeType(n.Path, n.In, val, *n.Minimum, n.ExclusiveMinimum); err != nil {
- resMinimum.Merge(errorHelp.sErr(err, n.Options.recycleResult))
+ if err := MinimumNativeType(n.Path.dotted(), n.In, val, *n.Minimum, n.ExclusiveMinimum); err != nil {
+ resMinimum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult))
}
} else {
// Constraint nevertheless validated, converted as general number
- if err := Minimum(n.Path, n.In, data, *n.Minimum, n.ExclusiveMinimum); err != nil {
- resMinimum.Merge(errorHelp.sErr(err, n.Options.recycleResult))
+ if err := Minimum(n.Path.dotted(), n.In, data, *n.Minimum, n.ExclusiveMinimum); err != nil {
+ resMinimum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult))
}
}
}
@@ -942,12 +937,16 @@ func (n *numberValidator) Validate(val any) *Result {
return res
}
+func (n *numberValidator) setPath(path pathSegments) {
+ n.Path = path
+}
+
func (n *numberValidator) redeem() {
- pools.poolOfNumberValidators.RedeemValidator(n)
+ validatorPools.numberValidators.Redeem(n)
}
type stringValidator struct {
- Path string
+ Path pathSegments
In string
Default any
Required bool
@@ -959,7 +958,7 @@ type stringValidator struct {
}
func newStringValidator(
- path, in string,
+ path pathSegments, in string,
def any, required, allowEmpty bool, maxLength, minLength *int64, pattern string,
opts *SchemaValidatorOptions,
) *stringValidator {
@@ -969,7 +968,7 @@ func newStringValidator(
var s *stringValidator
if opts.recycleValidators {
- s = pools.poolOfStringValidators.BorrowValidator()
+ s = validatorPools.stringValidators.Borrow()
} else {
s = new(stringValidator)
}
@@ -987,10 +986,6 @@ func newStringValidator(
return s
}
-func (s *stringValidator) SetPath(path string) {
- s.Path = path
-}
-
func (s *stringValidator) Applies(source any, kind reflect.Kind) bool {
switch source.(type) {
case *spec.Parameter, *spec.Schema, *spec.Items, *spec.Header:
@@ -1009,35 +1004,39 @@ func (s *stringValidator) Validate(val any) *Result {
data, ok := val.(string)
if !ok {
- return errorHelp.sErr(errors.InvalidType(s.Path, s.In, stringType, val), s.Options.recycleResult)
+ return errorHelp.sErrAt(s.Path, errors.InvalidType(s.Path.dotted(), s.In, stringType, val), s.Options.recycleResult)
}
if s.Required && !s.AllowEmptyValue && (s.Default == nil || s.Default == "") {
- if err := RequiredString(s.Path, s.In, data); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := RequiredString(s.Path.dotted(), s.In, data); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
if s.MaxLength != nil {
- if err := MaxLength(s.Path, s.In, data, *s.MaxLength); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := MaxLength(s.Path.dotted(), s.In, data, *s.MaxLength); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
if s.MinLength != nil {
- if err := MinLength(s.Path, s.In, data, *s.MinLength); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := MinLength(s.Path.dotted(), s.In, data, *s.MinLength); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
if s.Pattern != "" {
- if err := Pattern(s.Path, s.In, data, s.Pattern); err != nil {
- return errorHelp.sErr(err, s.Options.recycleResult)
+ if err := Pattern(s.Path.dotted(), s.In, data, s.Pattern); err != nil {
+ return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult)
}
}
return nil
}
+func (s *stringValidator) setPath(path pathSegments) {
+ s.Path = path
+}
+
func (s *stringValidator) redeem() {
- pools.poolOfStringValidators.RedeemValidator(s)
+ validatorPools.stringValidators.Redeem(s)
}
diff --git a/vendor/github.com/miekg/pkcs11/params.go b/vendor/github.com/miekg/pkcs11/params.go
index 6d9ce96ae8..f111086c37 100644
--- a/vendor/github.com/miekg/pkcs11/params.go
+++ b/vendor/github.com/miekg/pkcs11/params.go
@@ -26,6 +26,11 @@ static inline void putECDH1PublicParams(CK_ECDH1_DERIVE_PARAMS_PTR params, CK_VO
params->pPublicData = pPublicData;
params->ulPublicDataLen = ulPublicDataLen;
}
+
+static inline void putRSAAESKeyWrapParams(CK_RSA_AES_KEY_WRAP_PARAMS_PTR params, CK_VOID_PTR pOAEPParams)
+{
+ params->pOAEPParams = pOAEPParams;
+}
*/
import "C"
import "unsafe"
@@ -84,7 +89,7 @@ func cGCMParams(p *GCMParams) []byte {
p.Free()
p.arena = arena
p.params = ¶ms
- return C.GoBytes(unsafe.Pointer(¶ms), C.int(unsafe.Sizeof(params)))
+ return memBytes(unsafe.Pointer(¶ms), unsafe.Sizeof(params))
}
// IV returns a copy of the actual IV used for the operation.
@@ -121,7 +126,7 @@ func NewPSSParams(hashAlg, mgf, saltLength uint) []byte {
mgf: C.CK_RSA_PKCS_MGF_TYPE(mgf),
sLen: C.CK_ULONG(saltLength),
}
- return C.GoBytes(unsafe.Pointer(&p), C.int(unsafe.Sizeof(p)))
+ return memBytes(unsafe.Pointer(&p), unsafe.Sizeof(p))
}
// OAEPParams can be passed to NewMechanism to implement CKM_RSA_PKCS_OAEP.
@@ -153,7 +158,7 @@ func cOAEPParams(p *OAEPParams, arena arena) ([]byte, arena) {
// field is unaligned on windows so this has to call into C
C.putOAEPParams(¶ms, buf, len)
}
- return C.GoBytes(unsafe.Pointer(¶ms), C.int(unsafe.Sizeof(params))), arena
+ return memBytes(unsafe.Pointer(¶ms), unsafe.Sizeof(params)), arena
}
// ECDH1DeriveParams can be passed to NewMechanism to implement CK_ECDH1_DERIVE_PARAMS.
@@ -186,5 +191,25 @@ func cECDH1DeriveParams(p *ECDH1DeriveParams, arena arena) ([]byte, arena) {
publicKeyData, publicKeyDataLen := arena.Allocate(p.PublicKeyData)
C.putECDH1PublicParams(¶ms, publicKeyData, publicKeyDataLen)
- return C.GoBytes(unsafe.Pointer(¶ms), C.int(unsafe.Sizeof(params))), arena
+ return memBytes(unsafe.Pointer(¶ms), unsafe.Sizeof(params)), arena
}
+
+type RSAAESKeyWrapParams struct {
+ AESKeyBits uint
+ OAEPParams OAEPParams
+}
+
+func cRSAAESKeyWrapParams(p *RSAAESKeyWrapParams, arena arena) ([]byte, arena) {
+ var param []byte
+ params := C.CK_RSA_AES_KEY_WRAP_PARAMS {
+ ulAESKeyBits: C.CK_MECHANISM_TYPE(p.AESKeyBits),
+ }
+
+ param, arena = cOAEPParams(&p.OAEPParams, arena)
+ if len(param) != 0 {
+ buf, _ := arena.Allocate(param)
+ C.putRSAAESKeyWrapParams(¶ms, buf)
+ }
+ return memBytes(unsafe.Pointer(¶ms), unsafe.Sizeof(params)), arena
+}
+
diff --git a/vendor/github.com/miekg/pkcs11/pkcs11.go b/vendor/github.com/miekg/pkcs11/pkcs11.go
index e1b5824ec8..8d8d4c39cd 100644
--- a/vendor/github.com/miekg/pkcs11/pkcs11.go
+++ b/vendor/github.com/miekg/pkcs11/pkcs11.go
@@ -5,6 +5,8 @@
//go:generate go run const_generate.go
// Package pkcs11 is a wrapper around the PKCS#11 cryptographic library.
+// Latest version of the specification:
+// http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html
package pkcs11
// It is *assumed*, that:
@@ -104,11 +106,12 @@ void Destroy(struct ctx *c)
}
#endif
-CK_RV Initialize(struct ctx * c)
+CK_RV Initialize(struct ctx * c, CK_FLAGS flags, CK_VOID_PTR reserved)
{
CK_C_INITIALIZE_ARGS args;
memset(&args, 0, sizeof(args));
- args.flags = CKF_OS_LOCKING_OK;
+ args.flags = flags;
+ args.pReserved = reserved;
return c->sym->C_Initialize(&args);
}
@@ -803,9 +806,36 @@ func (c *Ctx) Destroy() {
c.ctx = nil
}
+type initializeArgs struct {
+ flags uint
+ reserved unsafe.Pointer
+}
+
+// An InitializeOption modifies the default behavior of Initialize.
+type InitializeOption func(*initializeArgs)
+
+// InitializeWithFlags sets the flags field in CK_C_INITIALIZE_ARGS.
+// Note that flags defaults to CKF_OS_LOCKING_OK if this option is not provided.
+func InitializeWithFlags(flags uint) InitializeOption {
+ return func(args *initializeArgs) {
+ args.flags = flags
+ }
+}
+
+// InitializeWithReserved sets the pReserved field in CK_C_INITIALIZE_ARGS.
+func InitializeWithReserved(reserved unsafe.Pointer) InitializeOption {
+ return func(args *initializeArgs) {
+ args.reserved = reserved
+ }
+}
+
// Initialize initializes the Cryptoki library.
-func (c *Ctx) Initialize() error {
- e := C.Initialize(c.ctx)
+func (c *Ctx) Initialize(opts ...InitializeOption) error {
+ args := initializeArgs{flags: CKF_OS_LOCKING_OK}
+ for _, o := range opts {
+ o(&args)
+ }
+ e := C.Initialize(c.ctx, C.CK_FLAGS(args.flags), C.CK_VOID_PTR(args.reserved))
return toError(e)
}
diff --git a/vendor/github.com/miekg/pkcs11/release.go b/vendor/github.com/miekg/pkcs11/release.go
index d8b99f147e..c9fcb0e735 100644
--- a/vendor/github.com/miekg/pkcs11/release.go
+++ b/vendor/github.com/miekg/pkcs11/release.go
@@ -6,7 +6,7 @@ package pkcs11
import "fmt"
// Release is current version of the pkcs11 library.
-var Release = R{1, 1, 1}
+var Release = R{1, 1, 2}
// R holds the version of this library.
type R struct {
diff --git a/vendor/github.com/miekg/pkcs11/types.go b/vendor/github.com/miekg/pkcs11/types.go
index 60eadcb71b..d3bfce80da 100644
--- a/vendor/github.com/miekg/pkcs11/types.go
+++ b/vendor/github.com/miekg/pkcs11/types.go
@@ -53,7 +53,7 @@ func toList(clist C.CK_ULONG_PTR, size C.CK_ULONG) []uint {
for i := 0; i < len(l); i++ {
l[i] = uint(C.Index(clist, C.CK_ULONG(i)))
}
- defer C.free(unsafe.Pointer(clist))
+ C.free(unsafe.Pointer(clist))
return l
}
@@ -65,9 +65,15 @@ func cBBool(x bool) C.CK_BBOOL {
return C.CK_BBOOL(C.CK_FALSE)
}
+// memBytes returns a byte slice that references an arbitrary memory area
+func memBytes(p unsafe.Pointer, len uintptr) []byte {
+ const maxIndex int32 = (1 << 31) - 1
+ return (*([maxIndex]byte))(p)[:len:len]
+}
+
func uintToBytes(x uint64) []byte {
ul := C.CK_ULONG(x)
- return C.GoBytes(unsafe.Pointer(&ul), C.int(unsafe.Sizeof(ul)))
+ return memBytes(unsafe.Pointer(&ul), unsafe.Sizeof(ul))
}
// Error represents an PKCS#11 error.
@@ -255,13 +261,14 @@ func NewMechanism(mech uint, x interface{}) *Mechanism {
}
switch p := x.(type) {
- case *GCMParams, *OAEPParams, *ECDH1DeriveParams:
+ case *GCMParams, *OAEPParams, *ECDH1DeriveParams, *RSAAESKeyWrapParams:
// contains pointers; defer serialization until cMechanism
m.generator = p
case []byte:
m.Parameter = p
default:
- panic("parameter must be one of type: []byte, *GCMParams, *OAEPParams, *ECDH1DeriveParams")
+ panic("parameter must be one of type: []byte, *GCMParams, *OAEPParams, *ECDH1DeriveParams," +
+ " *RSAAESKeyWrapParams")
}
return m
@@ -284,6 +291,8 @@ func cMechanism(mechList []*Mechanism) (arena, *C.CK_MECHANISM) {
param, arena = cOAEPParams(p, arena)
case *ECDH1DeriveParams:
param, arena = cECDH1DeriveParams(p, arena)
+ case *RSAAESKeyWrapParams:
+ param, arena = cRSAAESKeyWrapParams(p, arena)
}
if len(param) != 0 {
buf, len := arena.Allocate(param)
diff --git a/vendor/github.com/miekg/pkcs11/vendor.go b/vendor/github.com/miekg/pkcs11/vendor.go
index 83188e5001..5132dc4f07 100644
--- a/vendor/github.com/miekg/pkcs11/vendor.go
+++ b/vendor/github.com/miekg/pkcs11/vendor.go
@@ -10,12 +10,12 @@ const (
// Vendor specific mechanisms for HMAC on Ncipher HSMs where Ncipher does not allow use of generic_secret keys.
const (
- CKM_NC_SHA_1_HMAC_KEY_GEN = CKM_NCIPHER + 0x3 /* no params */
- CKM_NC_MD5_HMAC_KEY_GEN = CKM_NCIPHER + 0x6 /* no params */
- CKM_NC_SHA224_HMAC_KEY_GEN = CKM_NCIPHER + 0x24 /* no params */
- CKM_NC_SHA256_HMAC_KEY_GEN = CKM_NCIPHER + 0x25 /* no params */
- CKM_NC_SHA384_HMAC_KEY_GEN = CKM_NCIPHER + 0x26 /* no params */
- CKM_NC_SHA512_HMAC_KEY_GEN = CKM_NCIPHER + 0x27 /* no params */
+ CKM_NC_SHA_1_HMAC_KEY_GEN = CKM_NCIPHER + 0x3 // no params
+ CKM_NC_MD5_HMAC_KEY_GEN = CKM_NCIPHER + 0x6 // no params
+ CKM_NC_SHA224_HMAC_KEY_GEN = CKM_NCIPHER + 0x24 // no params
+ CKM_NC_SHA256_HMAC_KEY_GEN = CKM_NCIPHER + 0x25 // no params
+ CKM_NC_SHA384_HMAC_KEY_GEN = CKM_NCIPHER + 0x26 // no params
+ CKM_NC_SHA512_HMAC_KEY_GEN = CKM_NCIPHER + 0x27 // no params
)
// Vendor specific range for Mozilla NSS.
@@ -67,6 +67,8 @@ const (
CKA_NSS_JPAKE_X2 = CKA_NSS + 32
CKA_NSS_JPAKE_X2S = CKA_NSS + 33
CKA_NSS_MOZILLA_CA_POLICY = CKA_NSS + 34
+ CKA_NSS_SERVER_DISTRUST_AFTER = CKA_NSS + 35
+ CKA_NSS_EMAIL_DISTRUST_AFTER = CKA_NSS + 36
CKA_TRUST_DIGITAL_SIGNATURE = CKA_TRUST + 1
CKA_TRUST_NON_REPUDIATION = CKA_TRUST + 2
CKA_TRUST_KEY_ENCIPHERMENT = CKA_TRUST + 3
diff --git a/vendor/github.com/miekg/pkcs11/zconst.go b/vendor/github.com/miekg/pkcs11/zconst.go
index 41df5cfcf0..164054decc 100644
--- a/vendor/github.com/miekg/pkcs11/zconst.go
+++ b/vendor/github.com/miekg/pkcs11/zconst.go
@@ -7,107 +7,199 @@
package pkcs11
const (
- CK_TRUE = 1
- CK_FALSE = 0
- CK_UNAVAILABLE_INFORMATION = ^uint(0)
- CK_EFFECTIVELY_INFINITE = 0
- CK_INVALID_HANDLE = 0
- CKN_SURRENDER = 0
- CKN_OTP_CHANGED = 1
- CKF_TOKEN_PRESENT = 0x00000001
- CKF_REMOVABLE_DEVICE = 0x00000002
- CKF_HW_SLOT = 0x00000004
- CKF_RNG = 0x00000001
- CKF_WRITE_PROTECTED = 0x00000002
- CKF_LOGIN_REQUIRED = 0x00000004
- CKF_USER_PIN_INITIALIZED = 0x00000008
- CKF_RESTORE_KEY_NOT_NEEDED = 0x00000020
- CKF_CLOCK_ON_TOKEN = 0x00000040
- CKF_PROTECTED_AUTHENTICATION_PATH = 0x00000100
- CKF_DUAL_CRYPTO_OPERATIONS = 0x00000200
- CKF_TOKEN_INITIALIZED = 0x00000400
- CKF_SECONDARY_AUTHENTICATION = 0x00000800
- CKF_USER_PIN_COUNT_LOW = 0x00010000
- CKF_USER_PIN_FINAL_TRY = 0x00020000
- CKF_USER_PIN_LOCKED = 0x00040000
- CKF_USER_PIN_TO_BE_CHANGED = 0x00080000
- CKF_SO_PIN_COUNT_LOW = 0x00100000
- CKF_SO_PIN_FINAL_TRY = 0x00200000
- CKF_SO_PIN_LOCKED = 0x00400000
- CKF_SO_PIN_TO_BE_CHANGED = 0x00800000
- CKF_ERROR_STATE = 0x01000000
- CKU_SO = 0
- CKU_USER = 1
- CKU_CONTEXT_SPECIFIC = 2
- CKS_RO_PUBLIC_SESSION = 0
- CKS_RO_USER_FUNCTIONS = 1
- CKS_RW_PUBLIC_SESSION = 2
- CKS_RW_USER_FUNCTIONS = 3
- CKS_RW_SO_FUNCTIONS = 4
- CKF_RW_SESSION = 0x00000002
- CKF_SERIAL_SESSION = 0x00000004
- CKO_DATA = 0x00000000
- CKO_CERTIFICATE = 0x00000001
- CKO_PUBLIC_KEY = 0x00000002
- CKO_PRIVATE_KEY = 0x00000003
- CKO_SECRET_KEY = 0x00000004
- CKO_HW_FEATURE = 0x00000005
- CKO_DOMAIN_PARAMETERS = 0x00000006
- CKO_MECHANISM = 0x00000007
- CKO_OTP_KEY = 0x00000008
- CKO_VENDOR_DEFINED = 0x80000000
- CKH_MONOTONIC_COUNTER = 0x00000001
- CKH_CLOCK = 0x00000002
- CKH_USER_INTERFACE = 0x00000003
- CKH_VENDOR_DEFINED = 0x80000000
- CKK_RSA = 0x00000000
- CKK_DSA = 0x00000001
- CKK_DH = 0x00000002
- CKK_ECDSA = 0x00000003 // Deprecated
- CKK_EC = 0x00000003
- CKK_X9_42_DH = 0x00000004
- CKK_KEA = 0x00000005
- CKK_GENERIC_SECRET = 0x00000010
- CKK_RC2 = 0x00000011
- CKK_RC4 = 0x00000012
- CKK_DES = 0x00000013
- CKK_DES2 = 0x00000014
- CKK_DES3 = 0x00000015
- CKK_CAST = 0x00000016
- CKK_CAST3 = 0x00000017
- CKK_CAST5 = 0x00000018 // Deprecated
- CKK_CAST128 = 0x00000018
- CKK_RC5 = 0x00000019
- CKK_IDEA = 0x0000001A
- CKK_SKIPJACK = 0x0000001B
- CKK_BATON = 0x0000001C
- CKK_JUNIPER = 0x0000001D
- CKK_CDMF = 0x0000001E
- CKK_AES = 0x0000001F
- CKK_BLOWFISH = 0x00000020
- CKK_TWOFISH = 0x00000021
- CKK_SECURID = 0x00000022
- CKK_HOTP = 0x00000023
- CKK_ACTI = 0x00000024
- CKK_CAMELLIA = 0x00000025
- CKK_ARIA = 0x00000026
- CKK_MD5_HMAC = 0x00000027
- CKK_SHA_1_HMAC = 0x00000028
- CKK_RIPEMD128_HMAC = 0x00000029
- CKK_RIPEMD160_HMAC = 0x0000002A
- CKK_SHA256_HMAC = 0x0000002B
- CKK_SHA384_HMAC = 0x0000002C
- CKK_SHA512_HMAC = 0x0000002D
- CKK_SHA224_HMAC = 0x0000002E
- CKK_SEED = 0x0000002F
- CKK_GOSTR3410 = 0x00000030
- CKK_GOSTR3411 = 0x00000031
- CKK_GOST28147 = 0x00000032
- CKK_SHA3_224_HMAC = 0x00000033
- CKK_SHA3_256_HMAC = 0x00000034
- CKK_SHA3_384_HMAC = 0x00000035
- CKK_SHA3_512_HMAC = 0x00000036
- CKK_VENDOR_DEFINED = 0x80000000
+ CK_TRUE = true
+ CK_FALSE = false
+
+ // some special values for certain CK_ULONG variables
+ CK_UNAVAILABLE_INFORMATION = ^uint(0)
+ CK_EFFECTIVELY_INFINITE = 0
+
+ // The following value is always invalid if used as a session
+ // handle or object handle
+ CK_INVALID_HANDLE = 0
+
+ CKN_SURRENDER = 0
+ CKN_OTP_CHANGED = 1
+
+ // flags: bit flags that provide capabilities of the slot
+ //
+ // Bit Flag Mask Meaning
+ CKF_TOKEN_PRESENT = 0x00000001 // a token is there
+ CKF_REMOVABLE_DEVICE = 0x00000002 // removable devices
+ CKF_HW_SLOT = 0x00000004 // hardware slot
+
+ // The flags parameter is defined as follows:
+ //
+ // Bit Flag Mask Meaning
+ CKF_RNG = 0x00000001 // has random # generator
+ CKF_WRITE_PROTECTED = 0x00000002 // token is write-protected
+ CKF_LOGIN_REQUIRED = 0x00000004 // user must login
+ CKF_USER_PIN_INITIALIZED = 0x00000008 // normal user's PIN is set
+
+ // CKF_RESTORE_KEY_NOT_NEEDED. If it is set,
+ // that means that *every* time the state of cryptographic
+ // operations of a session is successfully saved, all keys
+ // needed to continue those operations are stored in the state
+ CKF_RESTORE_KEY_NOT_NEEDED = 0x00000020
+
+ // CKF_CLOCK_ON_TOKEN. If it is set, that means
+ // that the token has some sort of clock. The time on that
+ // clock is returned in the token info structure
+ CKF_CLOCK_ON_TOKEN = 0x00000040
+
+ // CKF_PROTECTED_AUTHENTICATION_PATH. If it is
+ // set, that means that there is some way for the user to login
+ // without sending a PIN through the Cryptoki library itself
+ CKF_PROTECTED_AUTHENTICATION_PATH = 0x00000100
+
+ // CKF_DUAL_CRYPTO_OPERATIONS. If it is true,
+ // that means that a single session with the token can perform
+ // dual simultaneous cryptographic operations (digest and
+ // encrypt; decrypt and digest; sign and encrypt; and decrypt
+ // and sign)
+ CKF_DUAL_CRYPTO_OPERATIONS = 0x00000200
+
+ // CKF_TOKEN_INITIALIZED. If it is true, the
+ // token has been initialized using C_InitializeToken or an
+ // equivalent mechanism outside the scope of PKCS #11.
+ // Calling C_InitializeToken when this flag is set will cause
+ // the token to be reinitialized.
+ CKF_TOKEN_INITIALIZED = 0x00000400
+
+ // CKF_SECONDARY_AUTHENTICATION. If it is
+ // true, the token supports secondary authentication for
+ // private key objects.
+ CKF_SECONDARY_AUTHENTICATION = 0x00000800
+
+ // CKF_USER_PIN_COUNT_LOW. If it is true, an
+ // incorrect user login PIN has been entered at least once
+ // since the last successful authentication.
+ CKF_USER_PIN_COUNT_LOW = 0x00010000
+
+ // CKF_USER_PIN_FINAL_TRY. If it is true,
+ // supplying an incorrect user PIN will it to become locked.
+ CKF_USER_PIN_FINAL_TRY = 0x00020000
+
+ // CKF_USER_PIN_LOCKED. If it is true, the
+ // user PIN has been locked. User login to the token is not
+ // possible.
+ CKF_USER_PIN_LOCKED = 0x00040000
+
+ // CKF_USER_PIN_TO_BE_CHANGED. If it is true,
+ // the user PIN value is the default value set by token
+ // initialization or manufacturing, or the PIN has been
+ // expired by the card.
+ CKF_USER_PIN_TO_BE_CHANGED = 0x00080000
+
+ // CKF_SO_PIN_COUNT_LOW. If it is true, an
+ // incorrect SO login PIN has been entered at least once since
+ // the last successful authentication.
+ CKF_SO_PIN_COUNT_LOW = 0x00100000
+
+ // CKF_SO_PIN_FINAL_TRY. If it is true,
+ // supplying an incorrect SO PIN will it to become locked.
+ CKF_SO_PIN_FINAL_TRY = 0x00200000
+
+ // CKF_SO_PIN_LOCKED. If it is true, the SO
+ // PIN has been locked. SO login to the token is not possible.
+ CKF_SO_PIN_LOCKED = 0x00400000
+
+ // CKF_SO_PIN_TO_BE_CHANGED. If it is true,
+ // the SO PIN value is the default value set by token
+ // initialization or manufacturing, or the PIN has been
+ // expired by the card.
+ CKF_SO_PIN_TO_BE_CHANGED = 0x00800000
+ CKF_ERROR_STATE = 0x01000000
+
+ // Security Officer
+ CKU_SO = 0
+
+ // Normal user
+ CKU_USER = 1
+
+ // Context specific
+ CKU_CONTEXT_SPECIFIC = 2
+
+ CKS_RO_PUBLIC_SESSION = 0
+ CKS_RO_USER_FUNCTIONS = 1
+ CKS_RW_PUBLIC_SESSION = 2
+ CKS_RW_USER_FUNCTIONS = 3
+ CKS_RW_SO_FUNCTIONS = 4
+
+ // The flags are defined in the following table:
+ //
+ // Bit Flag Mask Meaning
+ CKF_RW_SESSION = 0x00000002 // session is r/w
+ CKF_SERIAL_SESSION = 0x00000004 // no parallel
+
+ // The following classes of objects are defined:
+ CKO_DATA = 0x00000000
+ CKO_CERTIFICATE = 0x00000001
+ CKO_PUBLIC_KEY = 0x00000002
+ CKO_PRIVATE_KEY = 0x00000003
+ CKO_SECRET_KEY = 0x00000004
+ CKO_HW_FEATURE = 0x00000005
+ CKO_DOMAIN_PARAMETERS = 0x00000006
+ CKO_MECHANISM = 0x00000007
+ CKO_OTP_KEY = 0x00000008
+ CKO_VENDOR_DEFINED = 0x80000000
+
+ // The following hardware feature types are defined
+ CKH_MONOTONIC_COUNTER = 0x00000001
+ CKH_CLOCK = 0x00000002
+ CKH_USER_INTERFACE = 0x00000003
+ CKH_VENDOR_DEFINED = 0x80000000
+
+ // the following key types are defined:
+ CKK_RSA = 0x00000000
+ CKK_DSA = 0x00000001
+ CKK_DH = 0x00000002
+ CKK_ECDSA = 0x00000003 // Deprecated
+ CKK_EC = 0x00000003
+ CKK_X9_42_DH = 0x00000004
+ CKK_KEA = 0x00000005
+ CKK_GENERIC_SECRET = 0x00000010
+ CKK_RC2 = 0x00000011
+ CKK_RC4 = 0x00000012
+ CKK_DES = 0x00000013
+ CKK_DES2 = 0x00000014
+ CKK_DES3 = 0x00000015
+ CKK_CAST = 0x00000016
+ CKK_CAST3 = 0x00000017
+ CKK_CAST5 = 0x00000018 // Deprecated
+ CKK_CAST128 = 0x00000018
+ CKK_RC5 = 0x00000019
+ CKK_IDEA = 0x0000001A
+ CKK_SKIPJACK = 0x0000001B
+ CKK_BATON = 0x0000001C
+ CKK_JUNIPER = 0x0000001D
+ CKK_CDMF = 0x0000001E
+ CKK_AES = 0x0000001F
+ CKK_BLOWFISH = 0x00000020
+ CKK_TWOFISH = 0x00000021
+ CKK_SECURID = 0x00000022
+ CKK_HOTP = 0x00000023
+ CKK_ACTI = 0x00000024
+ CKK_CAMELLIA = 0x00000025
+ CKK_ARIA = 0x00000026
+ CKK_MD5_HMAC = 0x00000027
+ CKK_SHA_1_HMAC = 0x00000028
+ CKK_RIPEMD128_HMAC = 0x00000029
+ CKK_RIPEMD160_HMAC = 0x0000002A
+ CKK_SHA256_HMAC = 0x0000002B
+ CKK_SHA384_HMAC = 0x0000002C
+ CKK_SHA512_HMAC = 0x0000002D
+ CKK_SHA224_HMAC = 0x0000002E
+ CKK_SEED = 0x0000002F
+ CKK_GOSTR3410 = 0x00000030
+ CKK_GOSTR3411 = 0x00000031
+ CKK_GOST28147 = 0x00000032
+ CKK_SHA3_224_HMAC = 0x00000033
+ CKK_SHA3_256_HMAC = 0x00000034
+ CKK_SHA3_384_HMAC = 0x00000035
+ CKK_SHA3_512_HMAC = 0x00000036
+ CKK_VENDOR_DEFINED = 0x80000000
+
CK_CERTIFICATE_CATEGORY_UNSPECIFIED = 0
CK_CERTIFICATE_CATEGORY_TOKEN_USER = 1
CK_CERTIFICATE_CATEGORY_AUTHORITY = 2
@@ -116,513 +208,539 @@ const (
CK_SECURITY_DOMAIN_MANUFACTURER = 1
CK_SECURITY_DOMAIN_OPERATOR = 2
CK_SECURITY_DOMAIN_THIRD_PARTY = 3
- CKC_X_509 = 0x00000000
- CKC_X_509_ATTR_CERT = 0x00000001
- CKC_WTLS = 0x00000002
- CKC_VENDOR_DEFINED = 0x80000000
- CKF_ARRAY_ATTRIBUTE = 0x40000000
- CK_OTP_FORMAT_DECIMAL = 0
- CK_OTP_FORMAT_HEXADECIMAL = 1
- CK_OTP_FORMAT_ALPHANUMERIC = 2
- CK_OTP_FORMAT_BINARY = 3
- CK_OTP_PARAM_IGNORED = 0
- CK_OTP_PARAM_OPTIONAL = 1
- CK_OTP_PARAM_MANDATORY = 2
- CKA_CLASS = 0x00000000
- CKA_TOKEN = 0x00000001
- CKA_PRIVATE = 0x00000002
- CKA_LABEL = 0x00000003
- CKA_APPLICATION = 0x00000010
- CKA_VALUE = 0x00000011
- CKA_OBJECT_ID = 0x00000012
- CKA_CERTIFICATE_TYPE = 0x00000080
- CKA_ISSUER = 0x00000081
- CKA_SERIAL_NUMBER = 0x00000082
- CKA_AC_ISSUER = 0x00000083
- CKA_OWNER = 0x00000084
- CKA_ATTR_TYPES = 0x00000085
- CKA_TRUSTED = 0x00000086
- CKA_CERTIFICATE_CATEGORY = 0x00000087
- CKA_JAVA_MIDP_SECURITY_DOMAIN = 0x00000088
- CKA_URL = 0x00000089
- CKA_HASH_OF_SUBJECT_PUBLIC_KEY = 0x0000008A
- CKA_HASH_OF_ISSUER_PUBLIC_KEY = 0x0000008B
- CKA_NAME_HASH_ALGORITHM = 0x0000008C
- CKA_CHECK_VALUE = 0x00000090
- CKA_KEY_TYPE = 0x00000100
- CKA_SUBJECT = 0x00000101
- CKA_ID = 0x00000102
- CKA_SENSITIVE = 0x00000103
- CKA_ENCRYPT = 0x00000104
- CKA_DECRYPT = 0x00000105
- CKA_WRAP = 0x00000106
- CKA_UNWRAP = 0x00000107
- CKA_SIGN = 0x00000108
- CKA_SIGN_RECOVER = 0x00000109
- CKA_VERIFY = 0x0000010A
- CKA_VERIFY_RECOVER = 0x0000010B
- CKA_DERIVE = 0x0000010C
- CKA_START_DATE = 0x00000110
- CKA_END_DATE = 0x00000111
- CKA_MODULUS = 0x00000120
- CKA_MODULUS_BITS = 0x00000121
- CKA_PUBLIC_EXPONENT = 0x00000122
- CKA_PRIVATE_EXPONENT = 0x00000123
- CKA_PRIME_1 = 0x00000124
- CKA_PRIME_2 = 0x00000125
- CKA_EXPONENT_1 = 0x00000126
- CKA_EXPONENT_2 = 0x00000127
- CKA_COEFFICIENT = 0x00000128
- CKA_PUBLIC_KEY_INFO = 0x00000129
- CKA_PRIME = 0x00000130
- CKA_SUBPRIME = 0x00000131
- CKA_BASE = 0x00000132
- CKA_PRIME_BITS = 0x00000133
- CKA_SUBPRIME_BITS = 0x00000134
- CKA_SUB_PRIME_BITS = CKA_SUBPRIME_BITS
- CKA_VALUE_BITS = 0x00000160
- CKA_VALUE_LEN = 0x00000161
- CKA_EXTRACTABLE = 0x00000162
- CKA_LOCAL = 0x00000163
- CKA_NEVER_EXTRACTABLE = 0x00000164
- CKA_ALWAYS_SENSITIVE = 0x00000165
- CKA_KEY_GEN_MECHANISM = 0x00000166
- CKA_MODIFIABLE = 0x00000170
- CKA_COPYABLE = 0x00000171
- CKA_DESTROYABLE = 0x00000172
- CKA_ECDSA_PARAMS = 0x00000180 // Deprecated
- CKA_EC_PARAMS = 0x00000180
- CKA_EC_POINT = 0x00000181
- CKA_SECONDARY_AUTH = 0x00000200 // Deprecated
- CKA_AUTH_PIN_FLAGS = 0x00000201 // Deprecated
- CKA_ALWAYS_AUTHENTICATE = 0x00000202
- CKA_WRAP_WITH_TRUSTED = 0x00000210
- CKA_WRAP_TEMPLATE = (CKF_ARRAY_ATTRIBUTE | 0x00000211)
- CKA_UNWRAP_TEMPLATE = (CKF_ARRAY_ATTRIBUTE | 0x00000212)
- CKA_DERIVE_TEMPLATE = (CKF_ARRAY_ATTRIBUTE | 0x00000213)
- CKA_OTP_FORMAT = 0x00000220
- CKA_OTP_LENGTH = 0x00000221
- CKA_OTP_TIME_INTERVAL = 0x00000222
- CKA_OTP_USER_FRIENDLY_MODE = 0x00000223
- CKA_OTP_CHALLENGE_REQUIREMENT = 0x00000224
- CKA_OTP_TIME_REQUIREMENT = 0x00000225
- CKA_OTP_COUNTER_REQUIREMENT = 0x00000226
- CKA_OTP_PIN_REQUIREMENT = 0x00000227
- CKA_OTP_COUNTER = 0x0000022E
- CKA_OTP_TIME = 0x0000022F
- CKA_OTP_USER_IDENTIFIER = 0x0000022A
- CKA_OTP_SERVICE_IDENTIFIER = 0x0000022B
- CKA_OTP_SERVICE_LOGO = 0x0000022C
- CKA_OTP_SERVICE_LOGO_TYPE = 0x0000022D
- CKA_GOSTR3410_PARAMS = 0x00000250
- CKA_GOSTR3411_PARAMS = 0x00000251
- CKA_GOST28147_PARAMS = 0x00000252
- CKA_HW_FEATURE_TYPE = 0x00000300
- CKA_RESET_ON_INIT = 0x00000301
- CKA_HAS_RESET = 0x00000302
- CKA_PIXEL_X = 0x00000400
- CKA_PIXEL_Y = 0x00000401
- CKA_RESOLUTION = 0x00000402
- CKA_CHAR_ROWS = 0x00000403
- CKA_CHAR_COLUMNS = 0x00000404
- CKA_COLOR = 0x00000405
- CKA_BITS_PER_PIXEL = 0x00000406
- CKA_CHAR_SETS = 0x00000480
- CKA_ENCODING_METHODS = 0x00000481
- CKA_MIME_TYPES = 0x00000482
- CKA_MECHANISM_TYPE = 0x00000500
- CKA_REQUIRED_CMS_ATTRIBUTES = 0x00000501
- CKA_DEFAULT_CMS_ATTRIBUTES = 0x00000502
- CKA_SUPPORTED_CMS_ATTRIBUTES = 0x00000503
- CKA_ALLOWED_MECHANISMS = (CKF_ARRAY_ATTRIBUTE | 0x00000600)
- CKA_VENDOR_DEFINED = 0x80000000
- CKM_RSA_PKCS_KEY_PAIR_GEN = 0x00000000
- CKM_RSA_PKCS = 0x00000001
- CKM_RSA_9796 = 0x00000002
- CKM_RSA_X_509 = 0x00000003
- CKM_MD2_RSA_PKCS = 0x00000004
- CKM_MD5_RSA_PKCS = 0x00000005
- CKM_SHA1_RSA_PKCS = 0x00000006
- CKM_RIPEMD128_RSA_PKCS = 0x00000007
- CKM_RIPEMD160_RSA_PKCS = 0x00000008
- CKM_RSA_PKCS_OAEP = 0x00000009
- CKM_RSA_X9_31_KEY_PAIR_GEN = 0x0000000A
- CKM_RSA_X9_31 = 0x0000000B
- CKM_SHA1_RSA_X9_31 = 0x0000000C
- CKM_RSA_PKCS_PSS = 0x0000000D
- CKM_SHA1_RSA_PKCS_PSS = 0x0000000E
- CKM_DSA_KEY_PAIR_GEN = 0x00000010
- CKM_DSA = 0x00000011
- CKM_DSA_SHA1 = 0x00000012
- CKM_DSA_SHA224 = 0x00000013
- CKM_DSA_SHA256 = 0x00000014
- CKM_DSA_SHA384 = 0x00000015
- CKM_DSA_SHA512 = 0x00000016
- CKM_DSA_SHA3_224 = 0x00000018
- CKM_DSA_SHA3_256 = 0x00000019
- CKM_DSA_SHA3_384 = 0x0000001A
- CKM_DSA_SHA3_512 = 0x0000001B
- CKM_DH_PKCS_KEY_PAIR_GEN = 0x00000020
- CKM_DH_PKCS_DERIVE = 0x00000021
- CKM_X9_42_DH_KEY_PAIR_GEN = 0x00000030
- CKM_X9_42_DH_DERIVE = 0x00000031
- CKM_X9_42_DH_HYBRID_DERIVE = 0x00000032
- CKM_X9_42_MQV_DERIVE = 0x00000033
- CKM_SHA256_RSA_PKCS = 0x00000040
- CKM_SHA384_RSA_PKCS = 0x00000041
- CKM_SHA512_RSA_PKCS = 0x00000042
- CKM_SHA256_RSA_PKCS_PSS = 0x00000043
- CKM_SHA384_RSA_PKCS_PSS = 0x00000044
- CKM_SHA512_RSA_PKCS_PSS = 0x00000045
- CKM_SHA224_RSA_PKCS = 0x00000046
- CKM_SHA224_RSA_PKCS_PSS = 0x00000047
- CKM_SHA512_224 = 0x00000048
- CKM_SHA512_224_HMAC = 0x00000049
- CKM_SHA512_224_HMAC_GENERAL = 0x0000004A
- CKM_SHA512_224_KEY_DERIVATION = 0x0000004B
- CKM_SHA512_256 = 0x0000004C
- CKM_SHA512_256_HMAC = 0x0000004D
- CKM_SHA512_256_HMAC_GENERAL = 0x0000004E
- CKM_SHA512_256_KEY_DERIVATION = 0x0000004F
- CKM_SHA512_T = 0x00000050
- CKM_SHA512_T_HMAC = 0x00000051
- CKM_SHA512_T_HMAC_GENERAL = 0x00000052
- CKM_SHA512_T_KEY_DERIVATION = 0x00000053
- CKM_SHA3_256_RSA_PKCS = 0x00000060
- CKM_SHA3_384_RSA_PKCS = 0x00000061
- CKM_SHA3_512_RSA_PKCS = 0x00000062
- CKM_SHA3_256_RSA_PKCS_PSS = 0x00000063
- CKM_SHA3_384_RSA_PKCS_PSS = 0x00000064
- CKM_SHA3_512_RSA_PKCS_PSS = 0x00000065
- CKM_SHA3_224_RSA_PKCS = 0x00000066
- CKM_SHA3_224_RSA_PKCS_PSS = 0x00000067
- CKM_RC2_KEY_GEN = 0x00000100
- CKM_RC2_ECB = 0x00000101
- CKM_RC2_CBC = 0x00000102
- CKM_RC2_MAC = 0x00000103
- CKM_RC2_MAC_GENERAL = 0x00000104
- CKM_RC2_CBC_PAD = 0x00000105
- CKM_RC4_KEY_GEN = 0x00000110
- CKM_RC4 = 0x00000111
- CKM_DES_KEY_GEN = 0x00000120
- CKM_DES_ECB = 0x00000121
- CKM_DES_CBC = 0x00000122
- CKM_DES_MAC = 0x00000123
- CKM_DES_MAC_GENERAL = 0x00000124
- CKM_DES_CBC_PAD = 0x00000125
- CKM_DES2_KEY_GEN = 0x00000130
- CKM_DES3_KEY_GEN = 0x00000131
- CKM_DES3_ECB = 0x00000132
- CKM_DES3_CBC = 0x00000133
- CKM_DES3_MAC = 0x00000134
- CKM_DES3_MAC_GENERAL = 0x00000135
- CKM_DES3_CBC_PAD = 0x00000136
- CKM_DES3_CMAC_GENERAL = 0x00000137
- CKM_DES3_CMAC = 0x00000138
- CKM_CDMF_KEY_GEN = 0x00000140
- CKM_CDMF_ECB = 0x00000141
- CKM_CDMF_CBC = 0x00000142
- CKM_CDMF_MAC = 0x00000143
- CKM_CDMF_MAC_GENERAL = 0x00000144
- CKM_CDMF_CBC_PAD = 0x00000145
- CKM_DES_OFB64 = 0x00000150
- CKM_DES_OFB8 = 0x00000151
- CKM_DES_CFB64 = 0x00000152
- CKM_DES_CFB8 = 0x00000153
- CKM_MD2 = 0x00000200
- CKM_MD2_HMAC = 0x00000201
- CKM_MD2_HMAC_GENERAL = 0x00000202
- CKM_MD5 = 0x00000210
- CKM_MD5_HMAC = 0x00000211
- CKM_MD5_HMAC_GENERAL = 0x00000212
- CKM_SHA_1 = 0x00000220
- CKM_SHA_1_HMAC = 0x00000221
- CKM_SHA_1_HMAC_GENERAL = 0x00000222
- CKM_RIPEMD128 = 0x00000230
- CKM_RIPEMD128_HMAC = 0x00000231
- CKM_RIPEMD128_HMAC_GENERAL = 0x00000232
- CKM_RIPEMD160 = 0x00000240
- CKM_RIPEMD160_HMAC = 0x00000241
- CKM_RIPEMD160_HMAC_GENERAL = 0x00000242
- CKM_SHA256 = 0x00000250
- CKM_SHA256_HMAC = 0x00000251
- CKM_SHA256_HMAC_GENERAL = 0x00000252
- CKM_SHA224 = 0x00000255
- CKM_SHA224_HMAC = 0x00000256
- CKM_SHA224_HMAC_GENERAL = 0x00000257
- CKM_SHA384 = 0x00000260
- CKM_SHA384_HMAC = 0x00000261
- CKM_SHA384_HMAC_GENERAL = 0x00000262
- CKM_SHA512 = 0x00000270
- CKM_SHA512_HMAC = 0x00000271
- CKM_SHA512_HMAC_GENERAL = 0x00000272
- CKM_SECURID_KEY_GEN = 0x00000280
- CKM_SECURID = 0x00000282
- CKM_HOTP_KEY_GEN = 0x00000290
- CKM_HOTP = 0x00000291
- CKM_ACTI = 0x000002A0
- CKM_ACTI_KEY_GEN = 0x000002A1
- CKM_SHA3_256 = 0x000002B0
- CKM_SHA3_256_HMAC = 0x000002B1
- CKM_SHA3_256_HMAC_GENERAL = 0x000002B2
- CKM_SHA3_256_KEY_GEN = 0x000002B3
- CKM_SHA3_224 = 0x000002B5
- CKM_SHA3_224_HMAC = 0x000002B6
- CKM_SHA3_224_HMAC_GENERAL = 0x000002B7
- CKM_SHA3_224_KEY_GEN = 0x000002B8
- CKM_SHA3_384 = 0x000002C0
- CKM_SHA3_384_HMAC = 0x000002C1
- CKM_SHA3_384_HMAC_GENERAL = 0x000002C2
- CKM_SHA3_384_KEY_GEN = 0x000002C3
- CKM_SHA3_512 = 0x000002D0
- CKM_SHA3_512_HMAC = 0x000002D1
- CKM_SHA3_512_HMAC_GENERAL = 0x000002D2
- CKM_SHA3_512_KEY_GEN = 0x000002D3
- CKM_CAST_KEY_GEN = 0x00000300
- CKM_CAST_ECB = 0x00000301
- CKM_CAST_CBC = 0x00000302
- CKM_CAST_MAC = 0x00000303
- CKM_CAST_MAC_GENERAL = 0x00000304
- CKM_CAST_CBC_PAD = 0x00000305
- CKM_CAST3_KEY_GEN = 0x00000310
- CKM_CAST3_ECB = 0x00000311
- CKM_CAST3_CBC = 0x00000312
- CKM_CAST3_MAC = 0x00000313
- CKM_CAST3_MAC_GENERAL = 0x00000314
- CKM_CAST3_CBC_PAD = 0x00000315
- CKM_CAST5_KEY_GEN = 0x00000320
- CKM_CAST128_KEY_GEN = 0x00000320
- CKM_CAST5_ECB = 0x00000321
- CKM_CAST128_ECB = 0x00000321
- CKM_CAST5_CBC = 0x00000322 // Deprecated
- CKM_CAST128_CBC = 0x00000322
- CKM_CAST5_MAC = 0x00000323 // Deprecated
- CKM_CAST128_MAC = 0x00000323
- CKM_CAST5_MAC_GENERAL = 0x00000324 // Deprecated
- CKM_CAST128_MAC_GENERAL = 0x00000324
- CKM_CAST5_CBC_PAD = 0x00000325 // Deprecated
- CKM_CAST128_CBC_PAD = 0x00000325
- CKM_RC5_KEY_GEN = 0x00000330
- CKM_RC5_ECB = 0x00000331
- CKM_RC5_CBC = 0x00000332
- CKM_RC5_MAC = 0x00000333
- CKM_RC5_MAC_GENERAL = 0x00000334
- CKM_RC5_CBC_PAD = 0x00000335
- CKM_IDEA_KEY_GEN = 0x00000340
- CKM_IDEA_ECB = 0x00000341
- CKM_IDEA_CBC = 0x00000342
- CKM_IDEA_MAC = 0x00000343
- CKM_IDEA_MAC_GENERAL = 0x00000344
- CKM_IDEA_CBC_PAD = 0x00000345
- CKM_GENERIC_SECRET_KEY_GEN = 0x00000350
- CKM_CONCATENATE_BASE_AND_KEY = 0x00000360
- CKM_CONCATENATE_BASE_AND_DATA = 0x00000362
- CKM_CONCATENATE_DATA_AND_BASE = 0x00000363
- CKM_XOR_BASE_AND_DATA = 0x00000364
- CKM_EXTRACT_KEY_FROM_KEY = 0x00000365
- CKM_SSL3_PRE_MASTER_KEY_GEN = 0x00000370
- CKM_SSL3_MASTER_KEY_DERIVE = 0x00000371
- CKM_SSL3_KEY_AND_MAC_DERIVE = 0x00000372
- CKM_SSL3_MASTER_KEY_DERIVE_DH = 0x00000373
- CKM_TLS_PRE_MASTER_KEY_GEN = 0x00000374
- CKM_TLS_MASTER_KEY_DERIVE = 0x00000375
- CKM_TLS_KEY_AND_MAC_DERIVE = 0x00000376
- CKM_TLS_MASTER_KEY_DERIVE_DH = 0x00000377
- CKM_TLS_PRF = 0x00000378
- CKM_SSL3_MD5_MAC = 0x00000380
- CKM_SSL3_SHA1_MAC = 0x00000381
- CKM_MD5_KEY_DERIVATION = 0x00000390
- CKM_MD2_KEY_DERIVATION = 0x00000391
- CKM_SHA1_KEY_DERIVATION = 0x00000392
- CKM_SHA256_KEY_DERIVATION = 0x00000393
- CKM_SHA384_KEY_DERIVATION = 0x00000394
- CKM_SHA512_KEY_DERIVATION = 0x00000395
- CKM_SHA224_KEY_DERIVATION = 0x00000396
- CKM_SHA3_256_KEY_DERIVE = 0x00000397
- CKM_SHA3_224_KEY_DERIVE = 0x00000398
- CKM_SHA3_384_KEY_DERIVE = 0x00000399
- CKM_SHA3_512_KEY_DERIVE = 0x0000039A
- CKM_SHAKE_128_KEY_DERIVE = 0x0000039B
- CKM_SHAKE_256_KEY_DERIVE = 0x0000039C
- CKM_PBE_MD2_DES_CBC = 0x000003A0
- CKM_PBE_MD5_DES_CBC = 0x000003A1
- CKM_PBE_MD5_CAST_CBC = 0x000003A2
- CKM_PBE_MD5_CAST3_CBC = 0x000003A3
- CKM_PBE_MD5_CAST5_CBC = 0x000003A4 // Deprecated
- CKM_PBE_MD5_CAST128_CBC = 0x000003A4
- CKM_PBE_SHA1_CAST5_CBC = 0x000003A5 // Deprecated
- CKM_PBE_SHA1_CAST128_CBC = 0x000003A5
- CKM_PBE_SHA1_RC4_128 = 0x000003A6
- CKM_PBE_SHA1_RC4_40 = 0x000003A7
- CKM_PBE_SHA1_DES3_EDE_CBC = 0x000003A8
- CKM_PBE_SHA1_DES2_EDE_CBC = 0x000003A9
- CKM_PBE_SHA1_RC2_128_CBC = 0x000003AA
- CKM_PBE_SHA1_RC2_40_CBC = 0x000003AB
- CKM_PKCS5_PBKD2 = 0x000003B0
- CKM_PBA_SHA1_WITH_SHA1_HMAC = 0x000003C0
- CKM_WTLS_PRE_MASTER_KEY_GEN = 0x000003D0
- CKM_WTLS_MASTER_KEY_DERIVE = 0x000003D1
- CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC = 0x000003D2
- CKM_WTLS_PRF = 0x000003D3
- CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE = 0x000003D4
- CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE = 0x000003D5
- CKM_TLS10_MAC_SERVER = 0x000003D6
- CKM_TLS10_MAC_CLIENT = 0x000003D7
- CKM_TLS12_MAC = 0x000003D8
- CKM_TLS12_KDF = 0x000003D9
- CKM_TLS12_MASTER_KEY_DERIVE = 0x000003E0
- CKM_TLS12_KEY_AND_MAC_DERIVE = 0x000003E1
- CKM_TLS12_MASTER_KEY_DERIVE_DH = 0x000003E2
- CKM_TLS12_KEY_SAFE_DERIVE = 0x000003E3
- CKM_TLS_MAC = 0x000003E4
- CKM_TLS_KDF = 0x000003E5
- CKM_KEY_WRAP_LYNKS = 0x00000400
- CKM_KEY_WRAP_SET_OAEP = 0x00000401
- CKM_CMS_SIG = 0x00000500
- CKM_KIP_DERIVE = 0x00000510
- CKM_KIP_WRAP = 0x00000511
- CKM_KIP_MAC = 0x00000512
- CKM_CAMELLIA_KEY_GEN = 0x00000550
- CKM_CAMELLIA_ECB = 0x00000551
- CKM_CAMELLIA_CBC = 0x00000552
- CKM_CAMELLIA_MAC = 0x00000553
- CKM_CAMELLIA_MAC_GENERAL = 0x00000554
- CKM_CAMELLIA_CBC_PAD = 0x00000555
- CKM_CAMELLIA_ECB_ENCRYPT_DATA = 0x00000556
- CKM_CAMELLIA_CBC_ENCRYPT_DATA = 0x00000557
- CKM_CAMELLIA_CTR = 0x00000558
- CKM_ARIA_KEY_GEN = 0x00000560
- CKM_ARIA_ECB = 0x00000561
- CKM_ARIA_CBC = 0x00000562
- CKM_ARIA_MAC = 0x00000563
- CKM_ARIA_MAC_GENERAL = 0x00000564
- CKM_ARIA_CBC_PAD = 0x00000565
- CKM_ARIA_ECB_ENCRYPT_DATA = 0x00000566
- CKM_ARIA_CBC_ENCRYPT_DATA = 0x00000567
- CKM_SEED_KEY_GEN = 0x00000650
- CKM_SEED_ECB = 0x00000651
- CKM_SEED_CBC = 0x00000652
- CKM_SEED_MAC = 0x00000653
- CKM_SEED_MAC_GENERAL = 0x00000654
- CKM_SEED_CBC_PAD = 0x00000655
- CKM_SEED_ECB_ENCRYPT_DATA = 0x00000656
- CKM_SEED_CBC_ENCRYPT_DATA = 0x00000657
- CKM_SKIPJACK_KEY_GEN = 0x00001000
- CKM_SKIPJACK_ECB64 = 0x00001001
- CKM_SKIPJACK_CBC64 = 0x00001002
- CKM_SKIPJACK_OFB64 = 0x00001003
- CKM_SKIPJACK_CFB64 = 0x00001004
- CKM_SKIPJACK_CFB32 = 0x00001005
- CKM_SKIPJACK_CFB16 = 0x00001006
- CKM_SKIPJACK_CFB8 = 0x00001007
- CKM_SKIPJACK_WRAP = 0x00001008
- CKM_SKIPJACK_PRIVATE_WRAP = 0x00001009
- CKM_SKIPJACK_RELAYX = 0x0000100a
- CKM_KEA_KEY_PAIR_GEN = 0x00001010
- CKM_KEA_KEY_DERIVE = 0x00001011
- CKM_KEA_DERIVE = 0x00001012
- CKM_FORTEZZA_TIMESTAMP = 0x00001020
- CKM_BATON_KEY_GEN = 0x00001030
- CKM_BATON_ECB128 = 0x00001031
- CKM_BATON_ECB96 = 0x00001032
- CKM_BATON_CBC128 = 0x00001033
- CKM_BATON_COUNTER = 0x00001034
- CKM_BATON_SHUFFLE = 0x00001035
- CKM_BATON_WRAP = 0x00001036
- CKM_ECDSA_KEY_PAIR_GEN = 0x00001040 // Deprecated
- CKM_EC_KEY_PAIR_GEN = 0x00001040
- CKM_ECDSA = 0x00001041
- CKM_ECDSA_SHA1 = 0x00001042
- CKM_ECDSA_SHA224 = 0x00001043
- CKM_ECDSA_SHA256 = 0x00001044
- CKM_ECDSA_SHA384 = 0x00001045
- CKM_ECDSA_SHA512 = 0x00001046
- CKM_ECDH1_DERIVE = 0x00001050
- CKM_ECDH1_COFACTOR_DERIVE = 0x00001051
- CKM_ECMQV_DERIVE = 0x00001052
- CKM_ECDH_AES_KEY_WRAP = 0x00001053
- CKM_RSA_AES_KEY_WRAP = 0x00001054
- CKM_JUNIPER_KEY_GEN = 0x00001060
- CKM_JUNIPER_ECB128 = 0x00001061
- CKM_JUNIPER_CBC128 = 0x00001062
- CKM_JUNIPER_COUNTER = 0x00001063
- CKM_JUNIPER_SHUFFLE = 0x00001064
- CKM_JUNIPER_WRAP = 0x00001065
- CKM_FASTHASH = 0x00001070
- CKM_AES_KEY_GEN = 0x00001080
- CKM_AES_ECB = 0x00001081
- CKM_AES_CBC = 0x00001082
- CKM_AES_MAC = 0x00001083
- CKM_AES_MAC_GENERAL = 0x00001084
- CKM_AES_CBC_PAD = 0x00001085
- CKM_AES_CTR = 0x00001086
- CKM_AES_GCM = 0x00001087
- CKM_AES_CCM = 0x00001088
- CKM_AES_CTS = 0x00001089
- CKM_AES_CMAC = 0x0000108A
- CKM_AES_CMAC_GENERAL = 0x0000108B
- CKM_AES_XCBC_MAC = 0x0000108C
- CKM_AES_XCBC_MAC_96 = 0x0000108D
- CKM_AES_GMAC = 0x0000108E
- CKM_BLOWFISH_KEY_GEN = 0x00001090
- CKM_BLOWFISH_CBC = 0x00001091
- CKM_TWOFISH_KEY_GEN = 0x00001092
- CKM_TWOFISH_CBC = 0x00001093
- CKM_BLOWFISH_CBC_PAD = 0x00001094
- CKM_TWOFISH_CBC_PAD = 0x00001095
- CKM_DES_ECB_ENCRYPT_DATA = 0x00001100
- CKM_DES_CBC_ENCRYPT_DATA = 0x00001101
- CKM_DES3_ECB_ENCRYPT_DATA = 0x00001102
- CKM_DES3_CBC_ENCRYPT_DATA = 0x00001103
- CKM_AES_ECB_ENCRYPT_DATA = 0x00001104
- CKM_AES_CBC_ENCRYPT_DATA = 0x00001105
- CKM_GOSTR3410_KEY_PAIR_GEN = 0x00001200
- CKM_GOSTR3410 = 0x00001201
- CKM_GOSTR3410_WITH_GOSTR3411 = 0x00001202
- CKM_GOSTR3410_KEY_WRAP = 0x00001203
- CKM_GOSTR3410_DERIVE = 0x00001204
- CKM_GOSTR3411 = 0x00001210
- CKM_GOSTR3411_HMAC = 0x00001211
- CKM_GOST28147_KEY_GEN = 0x00001220
- CKM_GOST28147_ECB = 0x00001221
- CKM_GOST28147 = 0x00001222
- CKM_GOST28147_MAC = 0x00001223
- CKM_GOST28147_KEY_WRAP = 0x00001224
- CKM_DSA_PARAMETER_GEN = 0x00002000
- CKM_DH_PKCS_PARAMETER_GEN = 0x00002001
- CKM_X9_42_DH_PARAMETER_GEN = 0x00002002
- CKM_DSA_PROBABLISTIC_PARAMETER_GEN = 0x00002003
- CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN = 0x00002004
- CKM_AES_OFB = 0x00002104
- CKM_AES_CFB64 = 0x00002105
- CKM_AES_CFB8 = 0x00002106
- CKM_AES_CFB128 = 0x00002107
- CKM_AES_CFB1 = 0x00002108
- CKM_AES_KEY_WRAP = 0x00002109
- CKM_AES_KEY_WRAP_PAD = 0x0000210A
- CKM_RSA_PKCS_TPM_1_1 = 0x00004001
- CKM_RSA_PKCS_OAEP_TPM_1_1 = 0x00004002
- CKM_VENDOR_DEFINED = 0x80000000
- CKF_HW = 0x00000001
- CKF_ENCRYPT = 0x00000100
- CKF_DECRYPT = 0x00000200
- CKF_DIGEST = 0x00000400
- CKF_SIGN = 0x00000800
- CKF_SIGN_RECOVER = 0x00001000
- CKF_VERIFY = 0x00002000
- CKF_VERIFY_RECOVER = 0x00004000
- CKF_GENERATE = 0x00008000
- CKF_GENERATE_KEY_PAIR = 0x00010000
- CKF_WRAP = 0x00020000
- CKF_UNWRAP = 0x00040000
- CKF_DERIVE = 0x00080000
- CKF_EC_F_P = 0x00100000
- CKF_EC_F_2M = 0x00200000
- CKF_EC_ECPARAMETERS = 0x00400000
- CKF_EC_NAMEDCURVE = 0x00800000
- CKF_EC_UNCOMPRESS = 0x01000000
- CKF_EC_COMPRESS = 0x02000000
- CKF_EXTENSION = 0x80000000
+
+ // The following certificate types are defined:
+ CKC_X_509 = 0x00000000
+ CKC_X_509_ATTR_CERT = 0x00000001
+ CKC_WTLS = 0x00000002
+ CKC_VENDOR_DEFINED = 0x80000000
+
+ // The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which
+ // consists of an array of values.
+ CKF_ARRAY_ATTRIBUTE = 0x40000000
+
+ // The following OTP-related defines relate to the CKA_OTP_FORMAT attribute
+ CK_OTP_FORMAT_DECIMAL = 0
+ CK_OTP_FORMAT_HEXADECIMAL = 1
+ CK_OTP_FORMAT_ALPHANUMERIC = 2
+ CK_OTP_FORMAT_BINARY = 3
+
+ // The following OTP-related defines relate to the CKA_OTP_..._REQUIREMENT
+ // attributes
+ CK_OTP_PARAM_IGNORED = 0
+ CK_OTP_PARAM_OPTIONAL = 1
+ CK_OTP_PARAM_MANDATORY = 2
+
+ // The following attribute types are defined:
+ CKA_CLASS = 0x00000000
+ CKA_TOKEN = 0x00000001
+ CKA_PRIVATE = 0x00000002
+ CKA_LABEL = 0x00000003
+ CKA_APPLICATION = 0x00000010
+ CKA_VALUE = 0x00000011
+ CKA_OBJECT_ID = 0x00000012
+ CKA_CERTIFICATE_TYPE = 0x00000080
+ CKA_ISSUER = 0x00000081
+ CKA_SERIAL_NUMBER = 0x00000082
+ CKA_AC_ISSUER = 0x00000083
+ CKA_OWNER = 0x00000084
+ CKA_ATTR_TYPES = 0x00000085
+ CKA_TRUSTED = 0x00000086
+ CKA_CERTIFICATE_CATEGORY = 0x00000087
+ CKA_JAVA_MIDP_SECURITY_DOMAIN = 0x00000088
+ CKA_URL = 0x00000089
+ CKA_HASH_OF_SUBJECT_PUBLIC_KEY = 0x0000008A
+ CKA_HASH_OF_ISSUER_PUBLIC_KEY = 0x0000008B
+ CKA_NAME_HASH_ALGORITHM = 0x0000008C
+ CKA_CHECK_VALUE = 0x00000090
+ CKA_KEY_TYPE = 0x00000100
+ CKA_SUBJECT = 0x00000101
+ CKA_ID = 0x00000102
+ CKA_SENSITIVE = 0x00000103
+ CKA_ENCRYPT = 0x00000104
+ CKA_DECRYPT = 0x00000105
+ CKA_WRAP = 0x00000106
+ CKA_UNWRAP = 0x00000107
+ CKA_SIGN = 0x00000108
+ CKA_SIGN_RECOVER = 0x00000109
+ CKA_VERIFY = 0x0000010A
+ CKA_VERIFY_RECOVER = 0x0000010B
+ CKA_DERIVE = 0x0000010C
+ CKA_START_DATE = 0x00000110
+ CKA_END_DATE = 0x00000111
+ CKA_MODULUS = 0x00000120
+ CKA_MODULUS_BITS = 0x00000121
+ CKA_PUBLIC_EXPONENT = 0x00000122
+ CKA_PRIVATE_EXPONENT = 0x00000123
+ CKA_PRIME_1 = 0x00000124
+ CKA_PRIME_2 = 0x00000125
+ CKA_EXPONENT_1 = 0x00000126
+ CKA_EXPONENT_2 = 0x00000127
+ CKA_COEFFICIENT = 0x00000128
+ CKA_PUBLIC_KEY_INFO = 0x00000129
+ CKA_PRIME = 0x00000130
+ CKA_SUBPRIME = 0x00000131
+ CKA_BASE = 0x00000132
+ CKA_PRIME_BITS = 0x00000133
+ CKA_SUBPRIME_BITS = 0x00000134
+ CKA_SUB_PRIME_BITS = CKA_SUBPRIME_BITS
+ CKA_VALUE_BITS = 0x00000160
+ CKA_VALUE_LEN = 0x00000161
+ CKA_EXTRACTABLE = 0x00000162
+ CKA_LOCAL = 0x00000163
+ CKA_NEVER_EXTRACTABLE = 0x00000164
+ CKA_ALWAYS_SENSITIVE = 0x00000165
+ CKA_KEY_GEN_MECHANISM = 0x00000166
+ CKA_MODIFIABLE = 0x00000170
+ CKA_COPYABLE = 0x00000171
+ CKA_DESTROYABLE = 0x00000172
+ CKA_ECDSA_PARAMS = 0x00000180 // Deprecated
+ CKA_EC_PARAMS = 0x00000180
+ CKA_EC_POINT = 0x00000181
+ CKA_SECONDARY_AUTH = 0x00000200 // Deprecated
+ CKA_AUTH_PIN_FLAGS = 0x00000201 // Deprecated
+ CKA_ALWAYS_AUTHENTICATE = 0x00000202
+ CKA_WRAP_WITH_TRUSTED = 0x00000210
+ CKA_WRAP_TEMPLATE = (CKF_ARRAY_ATTRIBUTE | 0x00000211)
+ CKA_UNWRAP_TEMPLATE = (CKF_ARRAY_ATTRIBUTE | 0x00000212)
+ CKA_DERIVE_TEMPLATE = (CKF_ARRAY_ATTRIBUTE | 0x00000213)
+ CKA_OTP_FORMAT = 0x00000220
+ CKA_OTP_LENGTH = 0x00000221
+ CKA_OTP_TIME_INTERVAL = 0x00000222
+ CKA_OTP_USER_FRIENDLY_MODE = 0x00000223
+ CKA_OTP_CHALLENGE_REQUIREMENT = 0x00000224
+ CKA_OTP_TIME_REQUIREMENT = 0x00000225
+ CKA_OTP_COUNTER_REQUIREMENT = 0x00000226
+ CKA_OTP_PIN_REQUIREMENT = 0x00000227
+ CKA_OTP_COUNTER = 0x0000022E
+ CKA_OTP_TIME = 0x0000022F
+ CKA_OTP_USER_IDENTIFIER = 0x0000022A
+ CKA_OTP_SERVICE_IDENTIFIER = 0x0000022B
+ CKA_OTP_SERVICE_LOGO = 0x0000022C
+ CKA_OTP_SERVICE_LOGO_TYPE = 0x0000022D
+ CKA_GOSTR3410_PARAMS = 0x00000250
+ CKA_GOSTR3411_PARAMS = 0x00000251
+ CKA_GOST28147_PARAMS = 0x00000252
+ CKA_HW_FEATURE_TYPE = 0x00000300
+ CKA_RESET_ON_INIT = 0x00000301
+ CKA_HAS_RESET = 0x00000302
+ CKA_PIXEL_X = 0x00000400
+ CKA_PIXEL_Y = 0x00000401
+ CKA_RESOLUTION = 0x00000402
+ CKA_CHAR_ROWS = 0x00000403
+ CKA_CHAR_COLUMNS = 0x00000404
+ CKA_COLOR = 0x00000405
+ CKA_BITS_PER_PIXEL = 0x00000406
+ CKA_CHAR_SETS = 0x00000480
+ CKA_ENCODING_METHODS = 0x00000481
+ CKA_MIME_TYPES = 0x00000482
+ CKA_MECHANISM_TYPE = 0x00000500
+ CKA_REQUIRED_CMS_ATTRIBUTES = 0x00000501
+ CKA_DEFAULT_CMS_ATTRIBUTES = 0x00000502
+ CKA_SUPPORTED_CMS_ATTRIBUTES = 0x00000503
+ CKA_ALLOWED_MECHANISMS = (CKF_ARRAY_ATTRIBUTE | 0x00000600)
+ CKA_VENDOR_DEFINED = 0x80000000
+
+ // the following mechanism types are defined:
+ CKM_RSA_PKCS_KEY_PAIR_GEN = 0x00000000
+ CKM_RSA_PKCS = 0x00000001
+ CKM_RSA_9796 = 0x00000002
+ CKM_RSA_X_509 = 0x00000003
+ CKM_MD2_RSA_PKCS = 0x00000004
+ CKM_MD5_RSA_PKCS = 0x00000005
+ CKM_SHA1_RSA_PKCS = 0x00000006
+ CKM_RIPEMD128_RSA_PKCS = 0x00000007
+ CKM_RIPEMD160_RSA_PKCS = 0x00000008
+ CKM_RSA_PKCS_OAEP = 0x00000009
+ CKM_RSA_X9_31_KEY_PAIR_GEN = 0x0000000A
+ CKM_RSA_X9_31 = 0x0000000B
+ CKM_SHA1_RSA_X9_31 = 0x0000000C
+ CKM_RSA_PKCS_PSS = 0x0000000D
+ CKM_SHA1_RSA_PKCS_PSS = 0x0000000E
+ CKM_DSA_KEY_PAIR_GEN = 0x00000010
+ CKM_DSA = 0x00000011
+ CKM_DSA_SHA1 = 0x00000012
+ CKM_DSA_SHA224 = 0x00000013
+ CKM_DSA_SHA256 = 0x00000014
+ CKM_DSA_SHA384 = 0x00000015
+ CKM_DSA_SHA512 = 0x00000016
+ CKM_DSA_SHA3_224 = 0x00000018
+ CKM_DSA_SHA3_256 = 0x00000019
+ CKM_DSA_SHA3_384 = 0x0000001A
+ CKM_DSA_SHA3_512 = 0x0000001B
+ CKM_DH_PKCS_KEY_PAIR_GEN = 0x00000020
+ CKM_DH_PKCS_DERIVE = 0x00000021
+ CKM_X9_42_DH_KEY_PAIR_GEN = 0x00000030
+ CKM_X9_42_DH_DERIVE = 0x00000031
+ CKM_X9_42_DH_HYBRID_DERIVE = 0x00000032
+ CKM_X9_42_MQV_DERIVE = 0x00000033
+ CKM_SHA256_RSA_PKCS = 0x00000040
+ CKM_SHA384_RSA_PKCS = 0x00000041
+ CKM_SHA512_RSA_PKCS = 0x00000042
+ CKM_SHA256_RSA_PKCS_PSS = 0x00000043
+ CKM_SHA384_RSA_PKCS_PSS = 0x00000044
+ CKM_SHA512_RSA_PKCS_PSS = 0x00000045
+ CKM_SHA224_RSA_PKCS = 0x00000046
+ CKM_SHA224_RSA_PKCS_PSS = 0x00000047
+ CKM_SHA512_224 = 0x00000048
+ CKM_SHA512_224_HMAC = 0x00000049
+ CKM_SHA512_224_HMAC_GENERAL = 0x0000004A
+ CKM_SHA512_224_KEY_DERIVATION = 0x0000004B
+ CKM_SHA512_256 = 0x0000004C
+ CKM_SHA512_256_HMAC = 0x0000004D
+ CKM_SHA512_256_HMAC_GENERAL = 0x0000004E
+ CKM_SHA512_256_KEY_DERIVATION = 0x0000004F
+ CKM_SHA512_T = 0x00000050
+ CKM_SHA512_T_HMAC = 0x00000051
+ CKM_SHA512_T_HMAC_GENERAL = 0x00000052
+ CKM_SHA512_T_KEY_DERIVATION = 0x00000053
+ CKM_SHA3_256_RSA_PKCS = 0x00000060
+ CKM_SHA3_384_RSA_PKCS = 0x00000061
+ CKM_SHA3_512_RSA_PKCS = 0x00000062
+ CKM_SHA3_256_RSA_PKCS_PSS = 0x00000063
+ CKM_SHA3_384_RSA_PKCS_PSS = 0x00000064
+ CKM_SHA3_512_RSA_PKCS_PSS = 0x00000065
+ CKM_SHA3_224_RSA_PKCS = 0x00000066
+ CKM_SHA3_224_RSA_PKCS_PSS = 0x00000067
+ CKM_RC2_KEY_GEN = 0x00000100
+ CKM_RC2_ECB = 0x00000101
+ CKM_RC2_CBC = 0x00000102
+ CKM_RC2_MAC = 0x00000103
+ CKM_RC2_MAC_GENERAL = 0x00000104
+ CKM_RC2_CBC_PAD = 0x00000105
+ CKM_RC4_KEY_GEN = 0x00000110
+ CKM_RC4 = 0x00000111
+ CKM_DES_KEY_GEN = 0x00000120
+ CKM_DES_ECB = 0x00000121
+ CKM_DES_CBC = 0x00000122
+ CKM_DES_MAC = 0x00000123
+ CKM_DES_MAC_GENERAL = 0x00000124
+ CKM_DES_CBC_PAD = 0x00000125
+ CKM_DES2_KEY_GEN = 0x00000130
+ CKM_DES3_KEY_GEN = 0x00000131
+ CKM_DES3_ECB = 0x00000132
+ CKM_DES3_CBC = 0x00000133
+ CKM_DES3_MAC = 0x00000134
+ CKM_DES3_MAC_GENERAL = 0x00000135
+ CKM_DES3_CBC_PAD = 0x00000136
+ CKM_DES3_CMAC_GENERAL = 0x00000137
+ CKM_DES3_CMAC = 0x00000138
+ CKM_CDMF_KEY_GEN = 0x00000140
+ CKM_CDMF_ECB = 0x00000141
+ CKM_CDMF_CBC = 0x00000142
+ CKM_CDMF_MAC = 0x00000143
+ CKM_CDMF_MAC_GENERAL = 0x00000144
+ CKM_CDMF_CBC_PAD = 0x00000145
+ CKM_DES_OFB64 = 0x00000150
+ CKM_DES_OFB8 = 0x00000151
+ CKM_DES_CFB64 = 0x00000152
+ CKM_DES_CFB8 = 0x00000153
+ CKM_MD2 = 0x00000200
+ CKM_MD2_HMAC = 0x00000201
+ CKM_MD2_HMAC_GENERAL = 0x00000202
+ CKM_MD5 = 0x00000210
+ CKM_MD5_HMAC = 0x00000211
+ CKM_MD5_HMAC_GENERAL = 0x00000212
+ CKM_SHA_1 = 0x00000220
+ CKM_SHA_1_HMAC = 0x00000221
+ CKM_SHA_1_HMAC_GENERAL = 0x00000222
+ CKM_RIPEMD128 = 0x00000230
+ CKM_RIPEMD128_HMAC = 0x00000231
+ CKM_RIPEMD128_HMAC_GENERAL = 0x00000232
+ CKM_RIPEMD160 = 0x00000240
+ CKM_RIPEMD160_HMAC = 0x00000241
+ CKM_RIPEMD160_HMAC_GENERAL = 0x00000242
+ CKM_SHA256 = 0x00000250
+ CKM_SHA256_HMAC = 0x00000251
+ CKM_SHA256_HMAC_GENERAL = 0x00000252
+ CKM_SHA224 = 0x00000255
+ CKM_SHA224_HMAC = 0x00000256
+ CKM_SHA224_HMAC_GENERAL = 0x00000257
+ CKM_SHA384 = 0x00000260
+ CKM_SHA384_HMAC = 0x00000261
+ CKM_SHA384_HMAC_GENERAL = 0x00000262
+ CKM_SHA512 = 0x00000270
+ CKM_SHA512_HMAC = 0x00000271
+ CKM_SHA512_HMAC_GENERAL = 0x00000272
+ CKM_SECURID_KEY_GEN = 0x00000280
+ CKM_SECURID = 0x00000282
+ CKM_HOTP_KEY_GEN = 0x00000290
+ CKM_HOTP = 0x00000291
+ CKM_ACTI = 0x000002A0
+ CKM_ACTI_KEY_GEN = 0x000002A1
+ CKM_SHA3_256 = 0x000002B0
+ CKM_SHA3_256_HMAC = 0x000002B1
+ CKM_SHA3_256_HMAC_GENERAL = 0x000002B2
+ CKM_SHA3_256_KEY_GEN = 0x000002B3
+ CKM_SHA3_224 = 0x000002B5
+ CKM_SHA3_224_HMAC = 0x000002B6
+ CKM_SHA3_224_HMAC_GENERAL = 0x000002B7
+ CKM_SHA3_224_KEY_GEN = 0x000002B8
+ CKM_SHA3_384 = 0x000002C0
+ CKM_SHA3_384_HMAC = 0x000002C1
+ CKM_SHA3_384_HMAC_GENERAL = 0x000002C2
+ CKM_SHA3_384_KEY_GEN = 0x000002C3
+ CKM_SHA3_512 = 0x000002D0
+ CKM_SHA3_512_HMAC = 0x000002D1
+ CKM_SHA3_512_HMAC_GENERAL = 0x000002D2
+ CKM_SHA3_512_KEY_GEN = 0x000002D3
+ CKM_CAST_KEY_GEN = 0x00000300
+ CKM_CAST_ECB = 0x00000301
+ CKM_CAST_CBC = 0x00000302
+ CKM_CAST_MAC = 0x00000303
+ CKM_CAST_MAC_GENERAL = 0x00000304
+ CKM_CAST_CBC_PAD = 0x00000305
+ CKM_CAST3_KEY_GEN = 0x00000310
+ CKM_CAST3_ECB = 0x00000311
+ CKM_CAST3_CBC = 0x00000312
+ CKM_CAST3_MAC = 0x00000313
+ CKM_CAST3_MAC_GENERAL = 0x00000314
+ CKM_CAST3_CBC_PAD = 0x00000315
+
+ // Note that CAST128 and CAST5 are the same algorithm
+ CKM_CAST5_KEY_GEN = 0x00000320
+ CKM_CAST128_KEY_GEN = 0x00000320
+ CKM_CAST5_ECB = 0x00000321
+ CKM_CAST128_ECB = 0x00000321
+ CKM_CAST5_CBC = 0x00000322 // Deprecated
+ CKM_CAST128_CBC = 0x00000322
+ CKM_CAST5_MAC = 0x00000323 // Deprecated
+ CKM_CAST128_MAC = 0x00000323
+ CKM_CAST5_MAC_GENERAL = 0x00000324 // Deprecated
+ CKM_CAST128_MAC_GENERAL = 0x00000324
+ CKM_CAST5_CBC_PAD = 0x00000325 // Deprecated
+ CKM_CAST128_CBC_PAD = 0x00000325
+ CKM_RC5_KEY_GEN = 0x00000330
+ CKM_RC5_ECB = 0x00000331
+ CKM_RC5_CBC = 0x00000332
+ CKM_RC5_MAC = 0x00000333
+ CKM_RC5_MAC_GENERAL = 0x00000334
+ CKM_RC5_CBC_PAD = 0x00000335
+ CKM_IDEA_KEY_GEN = 0x00000340
+ CKM_IDEA_ECB = 0x00000341
+ CKM_IDEA_CBC = 0x00000342
+ CKM_IDEA_MAC = 0x00000343
+ CKM_IDEA_MAC_GENERAL = 0x00000344
+ CKM_IDEA_CBC_PAD = 0x00000345
+ CKM_GENERIC_SECRET_KEY_GEN = 0x00000350
+ CKM_CONCATENATE_BASE_AND_KEY = 0x00000360
+ CKM_CONCATENATE_BASE_AND_DATA = 0x00000362
+ CKM_CONCATENATE_DATA_AND_BASE = 0x00000363
+ CKM_XOR_BASE_AND_DATA = 0x00000364
+ CKM_EXTRACT_KEY_FROM_KEY = 0x00000365
+ CKM_SSL3_PRE_MASTER_KEY_GEN = 0x00000370
+ CKM_SSL3_MASTER_KEY_DERIVE = 0x00000371
+ CKM_SSL3_KEY_AND_MAC_DERIVE = 0x00000372
+ CKM_SSL3_MASTER_KEY_DERIVE_DH = 0x00000373
+ CKM_TLS_PRE_MASTER_KEY_GEN = 0x00000374
+ CKM_TLS_MASTER_KEY_DERIVE = 0x00000375
+ CKM_TLS_KEY_AND_MAC_DERIVE = 0x00000376
+ CKM_TLS_MASTER_KEY_DERIVE_DH = 0x00000377
+ CKM_TLS_PRF = 0x00000378
+ CKM_SSL3_MD5_MAC = 0x00000380
+ CKM_SSL3_SHA1_MAC = 0x00000381
+ CKM_MD5_KEY_DERIVATION = 0x00000390
+ CKM_MD2_KEY_DERIVATION = 0x00000391
+ CKM_SHA1_KEY_DERIVATION = 0x00000392
+ CKM_SHA256_KEY_DERIVATION = 0x00000393
+ CKM_SHA384_KEY_DERIVATION = 0x00000394
+ CKM_SHA512_KEY_DERIVATION = 0x00000395
+ CKM_SHA224_KEY_DERIVATION = 0x00000396
+ CKM_SHA3_256_KEY_DERIVE = 0x00000397
+ CKM_SHA3_224_KEY_DERIVE = 0x00000398
+ CKM_SHA3_384_KEY_DERIVE = 0x00000399
+ CKM_SHA3_512_KEY_DERIVE = 0x0000039A
+ CKM_SHAKE_128_KEY_DERIVE = 0x0000039B
+ CKM_SHAKE_256_KEY_DERIVE = 0x0000039C
+ CKM_PBE_MD2_DES_CBC = 0x000003A0
+ CKM_PBE_MD5_DES_CBC = 0x000003A1
+ CKM_PBE_MD5_CAST_CBC = 0x000003A2
+ CKM_PBE_MD5_CAST3_CBC = 0x000003A3
+ CKM_PBE_MD5_CAST5_CBC = 0x000003A4 // Deprecated
+ CKM_PBE_MD5_CAST128_CBC = 0x000003A4
+ CKM_PBE_SHA1_CAST5_CBC = 0x000003A5 // Deprecated
+ CKM_PBE_SHA1_CAST128_CBC = 0x000003A5
+ CKM_PBE_SHA1_RC4_128 = 0x000003A6
+ CKM_PBE_SHA1_RC4_40 = 0x000003A7
+ CKM_PBE_SHA1_DES3_EDE_CBC = 0x000003A8
+ CKM_PBE_SHA1_DES2_EDE_CBC = 0x000003A9
+ CKM_PBE_SHA1_RC2_128_CBC = 0x000003AA
+ CKM_PBE_SHA1_RC2_40_CBC = 0x000003AB
+ CKM_PKCS5_PBKD2 = 0x000003B0
+ CKM_PBA_SHA1_WITH_SHA1_HMAC = 0x000003C0
+ CKM_WTLS_PRE_MASTER_KEY_GEN = 0x000003D0
+ CKM_WTLS_MASTER_KEY_DERIVE = 0x000003D1
+ CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC = 0x000003D2
+ CKM_WTLS_PRF = 0x000003D3
+ CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE = 0x000003D4
+ CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE = 0x000003D5
+ CKM_TLS10_MAC_SERVER = 0x000003D6
+ CKM_TLS10_MAC_CLIENT = 0x000003D7
+ CKM_TLS12_MAC = 0x000003D8
+ CKM_TLS12_KDF = 0x000003D9
+ CKM_TLS12_MASTER_KEY_DERIVE = 0x000003E0
+ CKM_TLS12_KEY_AND_MAC_DERIVE = 0x000003E1
+ CKM_TLS12_MASTER_KEY_DERIVE_DH = 0x000003E2
+ CKM_TLS12_KEY_SAFE_DERIVE = 0x000003E3
+ CKM_TLS_MAC = 0x000003E4
+ CKM_TLS_KDF = 0x000003E5
+ CKM_KEY_WRAP_LYNKS = 0x00000400
+ CKM_KEY_WRAP_SET_OAEP = 0x00000401
+ CKM_CMS_SIG = 0x00000500
+ CKM_KIP_DERIVE = 0x00000510
+ CKM_KIP_WRAP = 0x00000511
+ CKM_KIP_MAC = 0x00000512
+ CKM_CAMELLIA_KEY_GEN = 0x00000550
+ CKM_CAMELLIA_ECB = 0x00000551
+ CKM_CAMELLIA_CBC = 0x00000552
+ CKM_CAMELLIA_MAC = 0x00000553
+ CKM_CAMELLIA_MAC_GENERAL = 0x00000554
+ CKM_CAMELLIA_CBC_PAD = 0x00000555
+ CKM_CAMELLIA_ECB_ENCRYPT_DATA = 0x00000556
+ CKM_CAMELLIA_CBC_ENCRYPT_DATA = 0x00000557
+ CKM_CAMELLIA_CTR = 0x00000558
+ CKM_ARIA_KEY_GEN = 0x00000560
+ CKM_ARIA_ECB = 0x00000561
+ CKM_ARIA_CBC = 0x00000562
+ CKM_ARIA_MAC = 0x00000563
+ CKM_ARIA_MAC_GENERAL = 0x00000564
+ CKM_ARIA_CBC_PAD = 0x00000565
+ CKM_ARIA_ECB_ENCRYPT_DATA = 0x00000566
+ CKM_ARIA_CBC_ENCRYPT_DATA = 0x00000567
+ CKM_SEED_KEY_GEN = 0x00000650
+ CKM_SEED_ECB = 0x00000651
+ CKM_SEED_CBC = 0x00000652
+ CKM_SEED_MAC = 0x00000653
+ CKM_SEED_MAC_GENERAL = 0x00000654
+ CKM_SEED_CBC_PAD = 0x00000655
+ CKM_SEED_ECB_ENCRYPT_DATA = 0x00000656
+ CKM_SEED_CBC_ENCRYPT_DATA = 0x00000657
+ CKM_SKIPJACK_KEY_GEN = 0x00001000
+ CKM_SKIPJACK_ECB64 = 0x00001001
+ CKM_SKIPJACK_CBC64 = 0x00001002
+ CKM_SKIPJACK_OFB64 = 0x00001003
+ CKM_SKIPJACK_CFB64 = 0x00001004
+ CKM_SKIPJACK_CFB32 = 0x00001005
+ CKM_SKIPJACK_CFB16 = 0x00001006
+ CKM_SKIPJACK_CFB8 = 0x00001007
+ CKM_SKIPJACK_WRAP = 0x00001008
+ CKM_SKIPJACK_PRIVATE_WRAP = 0x00001009
+ CKM_SKIPJACK_RELAYX = 0x0000100a
+ CKM_KEA_KEY_PAIR_GEN = 0x00001010
+ CKM_KEA_KEY_DERIVE = 0x00001011
+ CKM_KEA_DERIVE = 0x00001012
+ CKM_FORTEZZA_TIMESTAMP = 0x00001020
+ CKM_BATON_KEY_GEN = 0x00001030
+ CKM_BATON_ECB128 = 0x00001031
+ CKM_BATON_ECB96 = 0x00001032
+ CKM_BATON_CBC128 = 0x00001033
+ CKM_BATON_COUNTER = 0x00001034
+ CKM_BATON_SHUFFLE = 0x00001035
+ CKM_BATON_WRAP = 0x00001036
+ CKM_ECDSA_KEY_PAIR_GEN = 0x00001040 // Deprecated
+ CKM_EC_KEY_PAIR_GEN = 0x00001040
+ CKM_ECDSA = 0x00001041
+ CKM_ECDSA_SHA1 = 0x00001042
+ CKM_ECDSA_SHA224 = 0x00001043
+ CKM_ECDSA_SHA256 = 0x00001044
+ CKM_ECDSA_SHA384 = 0x00001045
+ CKM_ECDSA_SHA512 = 0x00001046
+ CKM_ECDH1_DERIVE = 0x00001050
+ CKM_ECDH1_COFACTOR_DERIVE = 0x00001051
+ CKM_ECMQV_DERIVE = 0x00001052
+ CKM_ECDH_AES_KEY_WRAP = 0x00001053
+ CKM_RSA_AES_KEY_WRAP = 0x00001054
+ CKM_JUNIPER_KEY_GEN = 0x00001060
+ CKM_JUNIPER_ECB128 = 0x00001061
+ CKM_JUNIPER_CBC128 = 0x00001062
+ CKM_JUNIPER_COUNTER = 0x00001063
+ CKM_JUNIPER_SHUFFLE = 0x00001064
+ CKM_JUNIPER_WRAP = 0x00001065
+ CKM_FASTHASH = 0x00001070
+ CKM_AES_KEY_GEN = 0x00001080
+ CKM_AES_ECB = 0x00001081
+ CKM_AES_CBC = 0x00001082
+ CKM_AES_MAC = 0x00001083
+ CKM_AES_MAC_GENERAL = 0x00001084
+ CKM_AES_CBC_PAD = 0x00001085
+ CKM_AES_CTR = 0x00001086
+ CKM_AES_GCM = 0x00001087
+ CKM_AES_CCM = 0x00001088
+ CKM_AES_CTS = 0x00001089
+ CKM_AES_CMAC = 0x0000108A
+ CKM_AES_CMAC_GENERAL = 0x0000108B
+ CKM_AES_XCBC_MAC = 0x0000108C
+ CKM_AES_XCBC_MAC_96 = 0x0000108D
+ CKM_AES_GMAC = 0x0000108E
+ CKM_BLOWFISH_KEY_GEN = 0x00001090
+ CKM_BLOWFISH_CBC = 0x00001091
+ CKM_TWOFISH_KEY_GEN = 0x00001092
+ CKM_TWOFISH_CBC = 0x00001093
+ CKM_BLOWFISH_CBC_PAD = 0x00001094
+ CKM_TWOFISH_CBC_PAD = 0x00001095
+ CKM_DES_ECB_ENCRYPT_DATA = 0x00001100
+ CKM_DES_CBC_ENCRYPT_DATA = 0x00001101
+ CKM_DES3_ECB_ENCRYPT_DATA = 0x00001102
+ CKM_DES3_CBC_ENCRYPT_DATA = 0x00001103
+ CKM_AES_ECB_ENCRYPT_DATA = 0x00001104
+ CKM_AES_CBC_ENCRYPT_DATA = 0x00001105
+ CKM_GOSTR3410_KEY_PAIR_GEN = 0x00001200
+ CKM_GOSTR3410 = 0x00001201
+ CKM_GOSTR3410_WITH_GOSTR3411 = 0x00001202
+ CKM_GOSTR3410_KEY_WRAP = 0x00001203
+ CKM_GOSTR3410_DERIVE = 0x00001204
+ CKM_GOSTR3411 = 0x00001210
+ CKM_GOSTR3411_HMAC = 0x00001211
+ CKM_GOST28147_KEY_GEN = 0x00001220
+ CKM_GOST28147_ECB = 0x00001221
+ CKM_GOST28147 = 0x00001222
+ CKM_GOST28147_MAC = 0x00001223
+ CKM_GOST28147_KEY_WRAP = 0x00001224
+ CKM_DSA_PARAMETER_GEN = 0x00002000
+ CKM_DH_PKCS_PARAMETER_GEN = 0x00002001
+ CKM_X9_42_DH_PARAMETER_GEN = 0x00002002
+ CKM_DSA_PROBABLISTIC_PARAMETER_GEN = 0x00002003
+ CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN = 0x00002004
+ CKM_AES_OFB = 0x00002104
+ CKM_AES_CFB64 = 0x00002105
+ CKM_AES_CFB8 = 0x00002106
+ CKM_AES_CFB128 = 0x00002107
+ CKM_AES_CFB1 = 0x00002108
+ CKM_AES_KEY_WRAP = 0x00002109 // WAS: 0x00001090
+ CKM_AES_KEY_WRAP_PAD = 0x0000210A // WAS: 0x00001091
+ CKM_RSA_PKCS_TPM_1_1 = 0x00004001
+ CKM_RSA_PKCS_OAEP_TPM_1_1 = 0x00004002
+ CKM_VENDOR_DEFINED = 0x80000000
+
+ // The flags are defined as follows:
+ //
+ // Bit Flag Mask Meaning
+ CKF_HW = 0x00000001 // performed by HW
+
+ // Specify whether or not a mechanism can be used for a particular task
+ CKF_ENCRYPT = 0x00000100
+ CKF_DECRYPT = 0x00000200
+ CKF_DIGEST = 0x00000400
+ CKF_SIGN = 0x00000800
+ CKF_SIGN_RECOVER = 0x00001000
+ CKF_VERIFY = 0x00002000
+ CKF_VERIFY_RECOVER = 0x00004000
+ CKF_GENERATE = 0x00008000
+ CKF_GENERATE_KEY_PAIR = 0x00010000
+ CKF_WRAP = 0x00020000
+ CKF_UNWRAP = 0x00040000
+ CKF_DERIVE = 0x00080000
+
+ // Describe a token's EC capabilities not available in mechanism
+ // information.
+ CKF_EC_F_P = 0x00100000
+ CKF_EC_F_2M = 0x00200000
+ CKF_EC_ECPARAMETERS = 0x00400000
+ CKF_EC_NAMEDCURVE = 0x00800000
+ CKF_EC_UNCOMPRESS = 0x01000000
+ CKF_EC_COMPRESS = 0x02000000
+ CKF_EXTENSION = 0x80000000
+
CKR_OK = 0x00000000
CKR_CANCEL = 0x00000001
CKR_HOST_MEMORY = 0x00000002
@@ -718,49 +836,69 @@ const (
CKR_PUBLIC_KEY_INVALID = 0x000001B9
CKR_FUNCTION_REJECTED = 0x00000200
CKR_VENDOR_DEFINED = 0x80000000
- CKF_LIBRARY_CANT_CREATE_OS_THREADS = 0x00000001
- CKF_OS_LOCKING_OK = 0x00000002
- CKF_DONT_BLOCK = 1
- CKG_MGF1_SHA1 = 0x00000001
- CKG_MGF1_SHA256 = 0x00000002
- CKG_MGF1_SHA384 = 0x00000003
- CKG_MGF1_SHA512 = 0x00000004
- CKG_MGF1_SHA224 = 0x00000005
- CKZ_DATA_SPECIFIED = 0x00000001
- CKD_NULL = 0x00000001
- CKD_SHA1_KDF = 0x00000002
- CKD_SHA1_KDF_ASN1 = 0x00000003
- CKD_SHA1_KDF_CONCATENATE = 0x00000004
- CKD_SHA224_KDF = 0x00000005
- CKD_SHA256_KDF = 0x00000006
- CKD_SHA384_KDF = 0x00000007
- CKD_SHA512_KDF = 0x00000008
- CKD_CPDIVERSIFY_KDF = 0x00000009
- CKD_SHA3_224_KDF = 0x0000000A
- CKD_SHA3_256_KDF = 0x0000000B
- CKD_SHA3_384_KDF = 0x0000000C
- CKD_SHA3_512_KDF = 0x0000000D
- CKP_PKCS5_PBKD2_HMAC_SHA1 = 0x00000001
- CKP_PKCS5_PBKD2_HMAC_GOSTR3411 = 0x00000002
- CKP_PKCS5_PBKD2_HMAC_SHA224 = 0x00000003
- CKP_PKCS5_PBKD2_HMAC_SHA256 = 0x00000004
- CKP_PKCS5_PBKD2_HMAC_SHA384 = 0x00000005
- CKP_PKCS5_PBKD2_HMAC_SHA512 = 0x00000006
- CKP_PKCS5_PBKD2_HMAC_SHA512_224 = 0x00000007
- CKP_PKCS5_PBKD2_HMAC_SHA512_256 = 0x00000008
- CKZ_SALT_SPECIFIED = 0x00000001
- CK_OTP_VALUE = 0
- CK_OTP_PIN = 1
- CK_OTP_CHALLENGE = 2
- CK_OTP_TIME = 3
- CK_OTP_COUNTER = 4
- CK_OTP_FLAGS = 5
- CK_OTP_OUTPUT_LENGTH = 6
- CK_OTP_OUTPUT_FORMAT = 7
- CKF_NEXT_OTP = 0x00000001
- CKF_EXCLUDE_TIME = 0x00000002
- CKF_EXCLUDE_COUNTER = 0x00000004
- CKF_EXCLUDE_CHALLENGE = 0x00000008
- CKF_EXCLUDE_PIN = 0x00000010
- CKF_USER_FRIENDLY_OTP = 0x00000020
+
+ // flags: bit flags that provide capabilities of the slot
+ //
+ // Bit Flag Mask Meaning
+ CKF_LIBRARY_CANT_CREATE_OS_THREADS = 0x00000001
+ CKF_OS_LOCKING_OK = 0x00000002
+
+ // additional flags for parameters to functions
+ // CKF_DONT_BLOCK is for the function C_WaitForSlotEvent
+ CKF_DONT_BLOCK = 1
+
+ // The following MGFs are defined
+ CKG_MGF1_SHA1 = 0x00000001
+ CKG_MGF1_SHA256 = 0x00000002
+ CKG_MGF1_SHA384 = 0x00000003
+ CKG_MGF1_SHA512 = 0x00000004
+ CKG_MGF1_SHA224 = 0x00000005
+
+ // The following encoding parameter sources are defined
+ CKZ_DATA_SPECIFIED = 0x00000001
+
+ // The following EC Key Derivation Functions are defined
+ CKD_NULL = 0x00000001
+ CKD_SHA1_KDF = 0x00000002
+
+ // The following X9.42 DH key derivation functions are defined
+ CKD_SHA1_KDF_ASN1 = 0x00000003
+ CKD_SHA1_KDF_CONCATENATE = 0x00000004
+ CKD_SHA224_KDF = 0x00000005
+ CKD_SHA256_KDF = 0x00000006
+ CKD_SHA384_KDF = 0x00000007
+ CKD_SHA512_KDF = 0x00000008
+ CKD_CPDIVERSIFY_KDF = 0x00000009
+ CKD_SHA3_224_KDF = 0x0000000A
+ CKD_SHA3_256_KDF = 0x0000000B
+ CKD_SHA3_384_KDF = 0x0000000C
+ CKD_SHA3_512_KDF = 0x0000000D
+
+ CKP_PKCS5_PBKD2_HMAC_SHA1 = 0x00000001
+ CKP_PKCS5_PBKD2_HMAC_GOSTR3411 = 0x00000002
+ CKP_PKCS5_PBKD2_HMAC_SHA224 = 0x00000003
+ CKP_PKCS5_PBKD2_HMAC_SHA256 = 0x00000004
+ CKP_PKCS5_PBKD2_HMAC_SHA384 = 0x00000005
+ CKP_PKCS5_PBKD2_HMAC_SHA512 = 0x00000006
+ CKP_PKCS5_PBKD2_HMAC_SHA512_224 = 0x00000007
+ CKP_PKCS5_PBKD2_HMAC_SHA512_256 = 0x00000008
+
+ // The following salt value sources are defined in PKCS #5 v2.0.
+ CKZ_SALT_SPECIFIED = 0x00000001
+
+ CK_OTP_VALUE = 0
+ CK_OTP_PIN = 1
+ CK_OTP_CHALLENGE = 2
+ CK_OTP_TIME = 3
+ CK_OTP_COUNTER = 4
+ CK_OTP_FLAGS = 5
+ CK_OTP_OUTPUT_LENGTH = 6
+ CK_OTP_OUTPUT_FORMAT = 7
+
+ CKF_NEXT_OTP = 0x00000001
+ CKF_EXCLUDE_TIME = 0x00000002
+ CKF_EXCLUDE_COUNTER = 0x00000004
+ CKF_EXCLUDE_CHALLENGE = 0x00000008
+ CKF_EXCLUDE_PIN = 0x00000010
+ CKF_USER_FRIENDLY_OTP = 0x00000020
)
diff --git a/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/header.go b/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/header.go
index 8547c8dfd1..820bf436ab 100644
--- a/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/header.go
+++ b/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/header.go
@@ -90,7 +90,7 @@ loop:
s = skipSpace(s[1:])
}
}
- return
+ return specs
}
func skipSpace(s string) (rest string) {
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/counter.go b/vendor/github.com/prometheus/client_golang/prometheus/counter.go
index 4ce84e7a80..7d963d3afb 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/counter.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/counter.go
@@ -85,11 +85,12 @@ type CounterVecOpts struct {
// Both internal tracking values are added up in the Write method. This has to
// be taken into account when it comes to precision and overflow behavior.
func NewCounter(opts CounterOpts) Counter {
- desc := NewDesc(
+ desc := V2.NewDesc(
BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
opts.Help,
- nil,
+ UnconstrainedLabels(nil),
opts.ConstLabels,
+ WithUnit(opts.Unit),
)
if opts.now == nil {
opts.now = time.Now
@@ -205,6 +206,7 @@ func (v2) NewCounterVec(opts CounterVecOpts) *CounterVec {
opts.Help,
opts.VariableLabels,
opts.ConstLabels,
+ WithUnit(opts.Unit),
)
if opts.now == nil {
opts.now = time.Now
@@ -349,10 +351,11 @@ type CounterFunc interface {
//
// Check out the ExampleGaugeFunc examples for the similar GaugeFunc.
func NewCounterFunc(opts CounterOpts, function func() float64) CounterFunc {
- return newValueFunc(NewDesc(
+ return newValueFunc(V2.NewDesc(
BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
opts.Help,
- nil,
+ UnconstrainedLabels(nil),
opts.ConstLabels,
+ WithUnit(opts.Unit),
), CounterValue, function)
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go
index 2331b8b4f3..a3c92e7a4c 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/desc.go
@@ -47,6 +47,8 @@ type Desc struct {
fqName string
// help provides some helpful information about this metric.
help string
+ // unit provides the unit of this metric.
+ unit string
// constLabelPairs contains precalculated DTO label pairs based on
// the constant labels.
constLabelPairs []*dto.LabelPair
@@ -66,6 +68,16 @@ type Desc struct {
err error
}
+// DescOpt allows setting optional fields for NewDesc.
+type DescOpt func(*Desc)
+
+// WithUnit sets the unit for a Desc.
+func WithUnit(unit string) DescOpt {
+ return func(d *Desc) {
+ d.unit = unit
+ }
+}
+
// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
// and will be reported on registration time. variableLabels and constLabels can
// be nil if no such labels should be set. fqName must not be empty.
@@ -89,14 +101,17 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
//
// For constLabels, the label values are constant. Therefore, they are fully
// specified in the Desc. See the Collector example for a usage pattern.
-func (v2) NewDesc(fqName, help string, variableLabels ConstrainableLabels, constLabels Labels) *Desc {
+func (v2) NewDesc(fqName, help string, variableLabels ConstrainableLabels, constLabels Labels, opts ...DescOpt) *Desc {
d := &Desc{
fqName: fqName,
help: help,
variableLabels: variableLabels.compile(),
}
- //nolint:staticcheck // TODO: Don't use deprecated model.NameValidationScheme.
- if !model.NameValidationScheme.IsValidMetricName(fqName) {
+
+ for _, opt := range opts {
+ opt(d)
+ }
+ if !model.UTF8Validation.IsValidMetricName(fqName) {
d.err = fmt.Errorf("%q is not a valid metric name", fqName)
return d
}
@@ -150,11 +165,13 @@ func (v2) NewDesc(fqName, help string, variableLabels ConstrainableLabels, const
d.id = xxh.Sum64()
// Sort labelNames so that order doesn't matter for the hash.
sort.Strings(labelNames)
- // Now hash together (in this order) the help string and the sorted
+ // Now hash together (in this order) the help string, the unit string and the sorted
// label names.
xxh.Reset()
xxh.WriteString(help)
xxh.Write(separatorByteSlice)
+ xxh.WriteString(d.unit)
+ xxh.Write(separatorByteSlice)
for _, labelName := range labelNames {
xxh.WriteString(labelName)
xxh.Write(separatorByteSlice)
@@ -182,6 +199,15 @@ func NewInvalidDesc(err error) *Desc {
}
}
+// Err returns an error that occurred during construction, if any.
+//
+// Calling this method is optional. It can be used to detect construction
+// errors early, before invoking other methods on the Desc. If an error is
+// present, later operations may not behave as expected.
+func (d *Desc) Err() error {
+ return d.err
+}
+
func (d *Desc) String() string {
lpStrings := make([]string, 0, len(d.constLabelPairs))
for _, lp := range d.constLabelPairs {
@@ -202,9 +228,10 @@ func (d *Desc) String() string {
}
}
return fmt.Sprintf(
- "Desc{fqName: %q, help: %q, constLabels: {%s}, variableLabels: {%s}}",
+ "Desc{fqName: %q, help: %q, unit: %q, constLabels: {%s}, variableLabels: {%s}}",
d.fqName,
d.help,
+ d.unit,
strings.Join(lpStrings, ","),
strings.Join(vlStrings, ","),
)
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
index de5a856293..327746f433 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
@@ -47,14 +47,14 @@ func (e *expvarCollector) Collect(ch chan<- Metric) {
if expVar == nil {
continue
}
- var v interface{}
+ var v any
labels := make([]string, len(desc.variableLabels.names))
if err := json.Unmarshal([]byte(expVar.String()), &v); err != nil {
ch <- NewInvalidMetric(desc, err)
continue
}
- var processValue func(v interface{}, i int)
- processValue = func(v interface{}, i int) {
+ var processValue func(v any, i int)
+ processValue = func(v any, i int) {
if i >= len(labels) {
copiedLabels := append(make([]string, 0, len(labels)), labels...)
switch v := v.(type) {
@@ -72,7 +72,7 @@ func (e *expvarCollector) Collect(ch chan<- Metric) {
ch <- m
return
}
- vm, ok := v.(map[string]interface{})
+ vm, ok := v.(map[string]any)
if !ok {
return
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
index dd2eac9406..41e54bf270 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
@@ -76,11 +76,12 @@ type GaugeVecOpts struct {
// scenarios for Gauges and Counters, where the former tends to be Set-heavy and
// the latter Inc-heavy.
func NewGauge(opts GaugeOpts) Gauge {
- desc := NewDesc(
+ desc := V2.NewDesc(
BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
opts.Help,
- nil,
+ UnconstrainedLabels(nil),
opts.ConstLabels,
+ WithUnit(opts.Unit),
)
result := &gauge{desc: desc, labelPairs: desc.constLabelPairs}
result.init(result) // Init self-collection.
@@ -163,6 +164,7 @@ func (v2) NewGaugeVec(opts GaugeVecOpts) *GaugeVec {
opts.Help,
opts.VariableLabels,
opts.ConstLabels,
+ WithUnit(opts.Unit),
)
return &GaugeVec{
MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
@@ -302,10 +304,11 @@ type GaugeFunc interface {
// value of 1. Example:
// https://github.com/prometheus/common/blob/8558a5b7db3c84fa38b4766966059a7bd5bfa2ee/version/info.go#L36-L56
func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc {
- return newValueFunc(NewDesc(
+ return newValueFunc(V2.NewDesc(
BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
opts.Help,
- nil,
+ UnconstrainedLabels(nil),
opts.ConstLabels,
+ WithUnit(opts.Unit),
), GaugeValue, function)
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go
deleted file mode 100644
index 897a6e906b..0000000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !go1.17
-// +build !go1.17
-
-package prometheus
-
-import (
- "runtime"
- "sync"
- "time"
-)
-
-type goCollector struct {
- base baseGoCollector
-
- // ms... are memstats related.
- msLast *runtime.MemStats // Previously collected memstats.
- msLastTimestamp time.Time
- msMtx sync.Mutex // Protects msLast and msLastTimestamp.
- msMetrics memStatsMetrics
- msRead func(*runtime.MemStats) // For mocking in tests.
- msMaxWait time.Duration // Wait time for fresh memstats.
- msMaxAge time.Duration // Maximum allowed age of old memstats.
-}
-
-// NewGoCollector is the obsolete version of collectors.NewGoCollector.
-// See there for documentation.
-//
-// Deprecated: Use collectors.NewGoCollector instead.
-func NewGoCollector() Collector {
- msMetrics := goRuntimeMemStats()
- msMetrics = append(msMetrics, struct {
- desc *Desc
- eval func(*runtime.MemStats) float64
- valType ValueType
- }{
- // This metric is omitted in Go1.17+, see https://github.com/prometheus/client_golang/issues/842#issuecomment-861812034
- desc: NewDesc(
- memstatNamespace("gc_cpu_fraction"),
- "The fraction of this program's available CPU time used by the GC since the program started.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return ms.GCCPUFraction },
- valType: GaugeValue,
- })
- return &goCollector{
- base: newBaseGoCollector(),
- msLast: &runtime.MemStats{},
- msRead: runtime.ReadMemStats,
- msMaxWait: time.Second,
- msMaxAge: 5 * time.Minute,
- msMetrics: msMetrics,
- }
-}
-
-// Describe returns all descriptions of the collector.
-func (c *goCollector) Describe(ch chan<- *Desc) {
- c.base.Describe(ch)
- for _, i := range c.msMetrics {
- ch <- i.desc
- }
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *goCollector) Collect(ch chan<- Metric) {
- var (
- ms = &runtime.MemStats{}
- done = make(chan struct{})
- )
- // Start reading memstats first as it might take a while.
- go func() {
- c.msRead(ms)
- c.msMtx.Lock()
- c.msLast = ms
- c.msLastTimestamp = time.Now()
- c.msMtx.Unlock()
- close(done)
- }()
-
- // Collect base non-memory metrics.
- c.base.Collect(ch)
-
- timer := time.NewTimer(c.msMaxWait)
- select {
- case <-done: // Our own ReadMemStats succeeded in time. Use it.
- timer.Stop() // Important for high collection frequencies to not pile up timers.
- c.msCollect(ch, ms)
- return
- case <-timer.C: // Time out, use last memstats if possible. Continue below.
- }
- c.msMtx.Lock()
- if time.Since(c.msLastTimestamp) < c.msMaxAge {
- // Last memstats are recent enough. Collect from them under the lock.
- c.msCollect(ch, c.msLast)
- c.msMtx.Unlock()
- return
- }
- // If we are here, the last memstats are too old or don't exist. We have
- // to wait until our own ReadMemStats finally completes. For that to
- // happen, we have to release the lock.
- c.msMtx.Unlock()
- <-done
- c.msCollect(ch, ms)
-}
-
-func (c *goCollector) msCollect(ch chan<- Metric, ms *runtime.MemStats) {
- for _, i := range c.msMetrics {
- ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms))
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go
index 6b8684731c..1db1c4be09 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go
@@ -98,7 +98,7 @@ type goCollector struct {
// snapshot is always produced by Collect.
mu sync.Mutex
- // Contains all samples that has to retrieved from runtime/metrics (not all of them will be exposed).
+ // Contains all samples that have to be retrieved from runtime/metrics (not all of them will be exposed).
sampleBuf []metrics.Sample
// sampleMap allows lookup for MemStats metrics and runtime/metrics histograms for exact sums.
sampleMap map[string]*metrics.Sample
@@ -210,16 +210,26 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector {
sampleBuf = append(sampleBuf, metrics.Sample{Name: d.Name})
sampleMap[d.Name] = &sampleBuf[len(sampleBuf)-1]
+ // Extract unit from the runtime/metrics name (e.g., "/gc/heap/allocs:bytes" -> "bytes")
+ // and sanitize to match Prometheus naming conventions (e.g., "cpu-seconds" -> "cpu_seconds")
+ var unit string
+ if idx := strings.IndexRune(d.Name, ':'); idx >= 0 {
+ unit = d.Name[idx+1:]
+ unit = strings.ReplaceAll(unit, "-", "_")
+ unit = strings.ReplaceAll(unit, "*", "_")
+ unit = strings.ReplaceAll(unit, "/", "_per_")
+ }
+
var m collectorMetric
if d.Kind == metrics.KindFloat64Histogram {
_, hasSum := opt.RuntimeMetricSumForHist[d.Name]
- unit := d.Name[strings.IndexRune(d.Name, ':')+1:]
m = newBatchHistogram(
- NewDesc(
+ V2.NewDesc(
BuildFQName(namespace, subsystem, name),
help,
+ UnconstrainedLabels(nil),
nil,
- nil,
+ WithUnit(unit),
),
internal.RuntimeMetricsBucketsForUnit(bucketsMap[d.Name], unit),
hasSum,
@@ -230,6 +240,7 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector {
Subsystem: subsystem,
Name: name,
Help: help,
+ Unit: unit,
},
)
} else {
@@ -238,6 +249,7 @@ func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector {
Subsystem: subsystem,
Name: name,
Help: help,
+ Unit: unit,
})
}
metricSet = append(metricSet, m)
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
index c453b754a7..88bae3b32c 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
@@ -378,6 +378,9 @@ type HistogramOpts struct {
// string.
Help string
+ // Unit provides the unit of this Histogram.
+ Unit string
+
// ConstLabels are used to attach fixed labels to this metric. Metrics
// with the same fully-qualified name must have the same label names in
// their ConstLabels.
@@ -522,11 +525,12 @@ type HistogramVecOpts struct {
// for each bucket.
func NewHistogram(opts HistogramOpts) Histogram {
return newHistogram(
- NewDesc(
+ V2.NewDesc(
BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
opts.Help,
- nil,
+ UnconstrainedLabels(nil),
opts.ConstLabels,
+ WithUnit(opts.Unit),
),
opts,
)
@@ -966,7 +970,7 @@ func (h *histogram) maybeReset(
// We are using the possibly mocked h.now() rather than
// time.Since(h.lastResetTime) to enable testing.
if h.nativeHistogramMinResetDuration == 0 || // No reset configured.
- h.resetScheduled || // Do not interefere if a reset is already scheduled.
+ h.resetScheduled || // Do not interfere if a reset is already scheduled.
h.now().Sub(h.lastResetTime) < h.nativeHistogramMinResetDuration {
return false
}
@@ -1053,8 +1057,8 @@ func (h *histogram) maybeWidenZeroBucket(hot, cold *histogramCounts) bool {
atomic.StoreUint64(&cold.nativeHistogramZeroThresholdBits, math.Float64bits(newZeroThreshold))
// ...and then merge the newly deleted buckets into the wider zero
// bucket.
- mergeAndDeleteOrAddAndReset := func(hotBuckets, coldBuckets *sync.Map) func(k, v interface{}) bool {
- return func(k, v interface{}) bool {
+ mergeAndDeleteOrAddAndReset := func(hotBuckets, coldBuckets *sync.Map) func(k, v any) bool {
+ return func(k, v any) bool {
key := k.(int)
bucket := v.(*int64)
if key == smallestKey {
@@ -1107,8 +1111,8 @@ func (h *histogram) doubleBucketWidth(hot, cold *histogramCounts) {
// ...adjust the schema in the cold counts, too...
atomic.StoreInt32(&cold.nativeHistogramSchema, coldSchema)
// ...and then merge the cold buckets into the wider hot buckets.
- merge := func(hotBuckets *sync.Map) func(k, v interface{}) bool {
- return func(k, v interface{}) bool {
+ merge := func(hotBuckets *sync.Map) func(k, v any) bool {
+ return func(k, v any) bool {
key := k.(int)
bucket := v.(*int64)
// Adjust key to match the bucket to merge into.
@@ -1190,6 +1194,7 @@ func (v2) NewHistogramVec(opts HistogramVecOpts) *HistogramVec {
opts.Help,
opts.VariableLabels,
opts.ConstLabels,
+ WithUnit(opts.Unit),
)
return &HistogramVec{
MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
@@ -1476,7 +1481,7 @@ func pickSchema(bucketFactor float64) int32 {
func makeBuckets(buckets *sync.Map) ([]*dto.BucketSpan, []int64) {
var ii []int
- buckets.Range(func(k, v interface{}) bool {
+ buckets.Range(func(k, v any) bool {
ii = append(ii, k.(int))
return true
})
@@ -1553,8 +1558,8 @@ func addToBucket(buckets *sync.Map, key int, increment int64) bool {
// according to the buckets ranged through. It then resets all buckets ranged
// through to 0 (but leaves them in place so that they don't need to get
// recreated on the next scrape).
-func addAndReset(hotBuckets *sync.Map, bucketNumber *uint32) func(k, v interface{}) bool {
- return func(k, v interface{}) bool {
+func addAndReset(hotBuckets *sync.Map, bucketNumber *uint32) func(k, v any) bool {
+ return func(k, v any) bool {
bucket := v.(*int64)
if addToBucket(hotBuckets, k.(int), atomic.LoadInt64(bucket)) {
atomic.AddUint32(bucketNumber, 1)
@@ -1565,7 +1570,7 @@ func addAndReset(hotBuckets *sync.Map, bucketNumber *uint32) func(k, v interface
}
func deleteSyncMap(m *sync.Map) {
- m.Range(func(k, v interface{}) bool {
+ m.Range(func(k, v any) bool {
m.Delete(k)
return true
})
@@ -1573,7 +1578,7 @@ func deleteSyncMap(m *sync.Map) {
func findSmallestKey(m *sync.Map) int {
result := math.MaxInt32
- m.Range(func(k, v interface{}) bool {
+ m.Range(func(k, v any) bool {
key := k.(int)
if key < result {
result = key
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go
index 7bac0da33d..2db270f216 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go
@@ -78,7 +78,7 @@ type OpCode struct {
// notion, pairing up elements that appear uniquely in each sequence.
// That, and the method here, appear to yield more intuitive difference
// reports than does diff. This method appears to be the least vulnerable
-// to synching up on blocks of "junk lines", though (like blank lines in
+// to syncing up on blocks of "junk lines", though (like blank lines in
// ordinary text files, or maybe "" lines in HTML files). That may be
// because this is the only method of the 3 that has a *concept* of
// "junk" .
@@ -567,7 +567,7 @@ type UnifiedDiff struct {
func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
buf := bufio.NewWriter(writer)
defer buf.Flush()
- wf := func(format string, args ...interface{}) error {
+ wf := func(format string, args ...any) error {
_, err := fmt.Fprintf(buf, format, args...)
return err
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/labels.go b/vendor/github.com/prometheus/client_golang/prometheus/labels.go
index 5fe8d3b4d2..a0285489a0 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/labels.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/labels.go
@@ -184,6 +184,5 @@ func validateLabelValues(vals []string, expectedNumberOfValues int) error {
}
func checkLabelName(l string) bool {
- //nolint:staticcheck // TODO: Don't use deprecated model.NameValidationScheme.
- return model.NameValidationScheme.IsValidLabelName(l) && !strings.HasPrefix(l, reservedLabelPrefix)
+ return model.UTF8Validation.IsValidLabelName(l) && !strings.HasPrefix(l, reservedLabelPrefix)
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go
index 76e59f1288..c5cb90adf8 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/metric.go
@@ -81,6 +81,9 @@ type Opts struct {
// string.
Help string
+ // Unit provides the unit of this metric as per https://prometheus.io/docs/specs/om
+ Unit string
+
// ConstLabels are used to attach fixed labels to this metric. Metrics
// with the same fully-qualified name must have the same label names in
// their ConstLabels.
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_darwin.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_darwin.go
index b32c95fa3f..2b16298f40 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_darwin.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_darwin.go
@@ -72,7 +72,13 @@ func getOpenFileCount() (float64, error) {
}
func (c *processCollector) processCollect(ch chan<- Metric) {
- if procs, err := unix.SysctlKinfoProcSlice("kern.proc.pid", os.Getpid()); err == nil {
+ pid, err := c.pidFn()
+ if err != nil {
+ c.reportError(ch, nil, err)
+ return
+ }
+
+ if procs, err := unix.SysctlKinfoProcSlice("kern.proc.pid", pid); err == nil {
if len(procs) == 1 {
startTime := float64(procs[0].Proc.P_starttime.Nano() / 1e9)
ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime)
@@ -84,6 +90,11 @@ func (c *processCollector) processCollect(ch chan<- Metric) {
c.reportError(ch, c.startTime, err)
}
+ if pid != os.Getpid() {
+ c.reportError(ch, nil, fmt.Errorf("collecting metrics for pid %d is not supported on darwin: process metrics collection is limited to the current process (pid %d)", pid, os.Getpid()))
+ return
+ }
+
// The proc structure returned by kern.proc.pid above has an Rusage member,
// but it is not filled in, so it needs to be fetched by getrusage(2). For
// that call, the UTime, STime, and Maxrss members are filled out, but not
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
index fa474289ef..c08dd05f03 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
@@ -30,6 +30,10 @@ var (
procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo")
procGetProcessHandleCount = modkernel32.NewProc("GetProcessHandleCount")
+
+ openProcess = windows.OpenProcess
+ closeHandle = windows.CloseHandle
+ getProcessTimes = windows.GetProcessTimes
)
type processMemoryCounters struct {
@@ -79,10 +83,21 @@ func getProcessHandleCount(handle windows.Handle) (uint32, error) {
}
func (c *processCollector) processCollect(ch chan<- Metric) {
- h := windows.CurrentProcess()
+ pid, err := c.pidFn()
+ if err != nil {
+ c.reportError(ch, nil, err)
+ return
+ }
+
+ h, err := openProcess(windows.PROCESS_QUERY_INFORMATION|windows.PROCESS_VM_READ, false, uint32(pid))
+ if err != nil {
+ c.reportError(ch, nil, err)
+ return
+ }
+ defer closeHandle(h)
var startTime, exitTime, kernelTime, userTime windows.Filetime
- err := windows.GetProcessTimes(h, &startTime, &exitTime, &kernelTime, &userTime)
+ err = getProcessTimes(h, &startTime, &exitTime, &kernelTime, &userTime)
if err != nil {
c.reportError(ch, nil, err)
return
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
index 763d99e362..c28af5ce2b 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
@@ -37,10 +37,12 @@ import (
"fmt"
"io"
"net/http"
+ "slices"
"strconv"
"sync"
"time"
+ dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil"
@@ -74,11 +76,118 @@ func defaultCompressionFormats() []Compression {
}
var gzipPool = sync.Pool{
- New: func() interface{} {
+ New: func() any {
return gzip.NewWriter(nil)
},
}
+// coalescingGatherer wraps a TransactionalGatherer to deduplicate concurrent
+// Gather calls. When a Gather is already in flight, new callers join the
+// existing cycle and receive the same result once it completes. The underlying
+// done function is called exactly once, when the last joined caller releases.
+//
+// This prevents goroutine pile-up when the scrape rate is faster than the
+// time collectors need to produce metrics.
+type coalescingGatherer struct {
+ g prometheus.TransactionalGatherer
+ mu sync.Mutex
+ cycle *gatherCycle
+}
+
+// gatherCycle tracks a single in-flight Gather and all HTTP handlers sharing it.
+type gatherCycle struct {
+ ready chan struct{} // closed when Gather completes; happens-before reads of mfs/err/done
+ mfs []*dto.MetricFamily // canonical result, set before ready is closed; callers get a slices.Clone, the element values stay shared and must not be mutated
+ err error // set before ready is closed
+ done func() // underlying done callback; set before ready is closed
+ refs int // number of handlers using this cycle; protected by coalescingGatherer.mu
+}
+
+var _ prometheus.TransactionalGatherer = (*coalescingGatherer)(nil) // compile-time interface check
+
+// errGatherPanicked is returned to callers that joined an in-flight coalesced
+// Gather whose underlying gatherer panicked. See the panic guard in Gather for
+// why joiners receive this error instead of the panic itself.
+var errGatherPanicked = errors.New("coalesced gather panicked")
+
+func (c *coalescingGatherer) Gather() ([]*dto.MetricFamily, func(), error) {
+ c.mu.Lock()
+ if cy := c.cycle; cy != nil {
+ // c.cycle is non-nil while Gather runs or handlers are still consuming its results.
+ cy.refs++
+ c.mu.Unlock()
+ <-cy.ready
+ // Each caller gets its own slice header so it can filter or reorder
+ // without racing other callers sharing this cycle. The *dto.MetricFamily
+ // values remain shared and must not be mutated in place.
+ return slices.Clone(cy.mfs), c.releaseFunc(cy), cy.err
+ }
+ cy := &gatherCycle{
+ ready: make(chan struct{}),
+ done: func() {},
+ refs: 1,
+ }
+ c.cycle = cy
+ c.mu.Unlock()
+
+ // Guard against a panic in c.g.Gather. The common case, a panicking
+ // Collector, never reaches here: Registry.Gather recovers Collector panics
+ // and returns them as an error. This guard only covers the rare case where
+ // the wrapped gatherer itself panics.
+ //
+ // We deliberately do not recover: the leader's panic propagates and is
+ // handled by net/http exactly as it would be without coalescing. We only
+ // set cy.err before closing cy.ready so joiners waiting on <-cy.ready fail
+ // with that error instead of silently returning an empty, successful
+ // response, and we clear c.cycle so the next Gather starts a fresh cycle.
+ //
+ // The leader never runs its own releaseFunc on this path, so its ref is
+ // not decremented; that is harmless because the cycle is detached (c.cycle
+ // = nil) and cy.done is still the no-op set at construction (c.g.Gather
+ // panicked before assigning a real done). If cy.done is ever made non-nil
+ // before c.g.Gather runs, this path would need to release it.
+ panicked := true
+ defer func() {
+ if panicked {
+ c.mu.Lock()
+ if c.cycle == cy {
+ c.cycle = nil
+ }
+ c.mu.Unlock()
+ cy.err = errGatherPanicked // set before close: happens-before joiners' reads
+ close(cy.ready)
+ }
+ }()
+ cy.mfs, cy.done, cy.err = c.g.Gather()
+ panicked = false
+ close(cy.ready) // happens-before joiners' reads of cy.mfs/err/done
+
+ // Clone here too so cy.mfs stays the write-once canonical slice: joiners
+ // read it concurrently via slices.Clone, so the leader must not hand out
+ // (and potentially reorder) the same backing array.
+ return slices.Clone(cy.mfs), c.releaseFunc(cy), cy.err
+}
+
+// releaseFunc returns the done callback for one caller sharing cy.
+// When the last caller releases, the underlying done is invoked and the
+// cycle is cleared so the next Gather starts fresh.
+func (c *coalescingGatherer) releaseFunc(cy *gatherCycle) func() {
+ return func() {
+ c.mu.Lock()
+ cy.refs--
+ if cy.refs > 0 {
+ c.mu.Unlock()
+ return
+ }
+ // Last caller.
+ if c.cycle == cy {
+ c.cycle = nil
+ }
+ c.mu.Unlock()
+ cy.done() // called outside the lock to avoid holding it during done
+ }
+}
+
// Handler returns an http.Handler for the prometheus.DefaultGatherer, using
// default HandlerOpts, i.e. it reports the first error as an HTTP error, it has
// no error logging, and it applies compression if requested by the client.
@@ -89,6 +198,10 @@ var gzipPool = sync.Pool{
// metrics used for instrumentation will be shared between them, providing
// global scrape counts.
//
+// The handler supports filtering metrics by name using the `name[]` query parameter.
+// Multiple metric names can be specified by providing the parameter multiple times.
+// When no name[] parameters are provided, all metrics are returned.
+//
// This function is meant to cover the bulk of basic use cases. If you are doing
// anything that requires more customization (including using a non-default
// Gatherer, different instrumentation, and non-default HandlerOpts), use the
@@ -105,6 +218,10 @@ func Handler() http.Handler {
// Gatherers, with non-default HandlerOpts, and/or with custom (or no)
// instrumentation. Use the InstrumentMetricHandler function to apply the same
// kind of instrumentation as it is used by the Handler function.
+//
+// The handler supports filtering metrics by name using the `name[]` query parameter.
+// Multiple metric names can be specified by providing the parameter multiple times.
+// When no name[] parameters are provided, all metrics are returned.
func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
return HandlerForTransactional(prometheus.ToTransactionalGatherer(reg), opts)
}
@@ -112,7 +229,15 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
// HandlerForTransactional is like HandlerFor, but it uses transactional gather, which
// can safely change in-place returned *dto.MetricFamily before call to `Gather` and after
// call to `done` of that `Gather`.
+//
+// The handler supports filtering metrics by name using the `name[]` query parameter.
+// Multiple metric names can be specified by providing the parameter multiple times.
+// When no name[] parameters are provided, all metrics are returned.
func HandlerForTransactional(reg prometheus.TransactionalGatherer, opts HandlerOpts) http.Handler {
+ if opts.CoalesceGather {
+ reg = &coalescingGatherer{g: reg}
+ }
+
var (
inFlightSem chan struct{}
errCnt = prometheus.NewCounterVec(
@@ -214,12 +339,14 @@ func HandlerForTransactional(reg prometheus.TransactionalGatherer, opts HandlerO
rsp.Header().Set(contentEncodingHeader, encodingHeader)
}
- var enc expfmt.Encoder
+ var (
+ enc expfmt.Encoder
+ encOpts []expfmt.EncoderOption
+ )
if opts.EnableOpenMetricsTextCreatedSamples {
- enc = expfmt.NewEncoder(w, contentType, expfmt.WithCreatedLines())
- } else {
- enc = expfmt.NewEncoder(w, contentType)
+ encOpts = append(encOpts, expfmt.WithCreatedLines())
}
+ enc = expfmt.NewEncoder(w, contentType, encOpts...)
// handleError handles the error according to opts.ErrorHandling
// and returns true if we have to abort after the handling.
@@ -245,7 +372,24 @@ func HandlerForTransactional(reg prometheus.TransactionalGatherer, opts HandlerO
return false
}
+ // Build metric name filter set from query params (if any). The URL
+ // can be nil on hand-constructed requests.
+ var metricFilter map[string]struct{}
+ if req.URL != nil {
+ if metricNames := req.URL.Query()["name[]"]; len(metricNames) > 0 {
+ metricFilter = make(map[string]struct{}, len(metricNames))
+ for _, name := range metricNames {
+ metricFilter[name] = struct{}{}
+ }
+ }
+ }
+
for _, mf := range mfs {
+ if metricFilter != nil {
+ if _, ok := metricFilter[mf.GetName()]; !ok {
+ continue
+ }
+ }
if handleError(enc.Encode(mf)) {
return
}
@@ -353,7 +497,7 @@ const (
// log.Logger from the standard library implements this interface, and it is
// easy to implement by custom loggers, if they don't do so already anyway.
type Logger interface {
- Println(v ...interface{})
+ Println(v ...any)
}
// HandlerOpts specifies options how to serve metrics via an http.Handler. The
@@ -400,6 +544,40 @@ type HandlerOpts struct {
// Service Unavailable and a suitable message in the body. If
// MaxRequestsInFlight is 0 or negative, no limit is applied.
MaxRequestsInFlight int
+ // CoalesceGather, if true, deduplicates concurrent Gather calls so that
+ // only one collection runs at a time. Additional requests that arrive
+ // while a Gather is in flight will receive the same result once it
+ // completes. This prevents goroutine pile-up when the scrape rate is
+ // faster than the time collectors need to produce metrics.
+ //
+ // When enabled, concurrent scrapers share a single metric snapshot per
+ // collection cycle. Each request receives its own copy of the returned
+ // slice, so filtering or reordering it (for example via name[] query
+ // parameters) is safe. The pointed-to MetricFamily values are still
+ // shared: the built-in handler only reads them, so this is safe in
+ // practice, but a custom TransactionalGatherer that mutates the returned
+ // families in place after Gather returns must not use this option.
+ //
+ // Because the snapshot is shared, a request that arrives while a cycle is
+ // in flight receives that cycle's result even though collection began
+ // before the request; two scrapers joined to one cycle observe the same
+ // timestamps rather than independently gathered data.
+ //
+ // Consider using CoalesceGather together with Timeout. Timeout bounds the
+ // client-facing response time and keeps at most one collection running at
+ // a time, but it does not cancel the underlying Gather: a joined request
+ // that times out still holds a MaxRequestsInFlight slot until the shared
+ // collection completes.
+ //
+ // Panic handling: a panicking Collector is already turned into an error by
+ // the registry, so joiners receive that error like any other. In the rare
+ // case where the wrapped gatherer itself panics, the panicking request's
+ // panic propagates as usual (handled by net/http), while requests that
+ // joined the same cycle receive an error rather than an empty response.
+ //
+ // NOTE: This option is experimental and may change or be removed in a
+ // future release.
+ CoalesceGather bool
// If handling a request takes longer than Timeout, it is responded to
// with 503 ServiceUnavailable and a suitable Message. No timeout is
// applied if Timeout is 0 or negative. Note that with the current
@@ -407,8 +585,9 @@ type HandlerOpts struct {
// described above (and even that only if sending of the body hasn't
// started yet), while the bulk work of gathering all the metrics keeps
// running in the background (with the eventual result to be thrown
- // away). Until the implementation is improved, it is recommended to
- // implement a separate timeout in potentially slow Collectors.
+ // away). When CoalesceGather is enabled, only one such background Gather
+ // can be in flight at a time. It is also recommended to implement a
+ // separate timeout in potentially slow Collectors.
Timeout time.Duration
// If true, the experimental OpenMetrics encoding is added to the
// possible options during content negotiation. Note that Prometheus
@@ -460,7 +639,7 @@ func httpError(rsp http.ResponseWriter, err error) {
// negotiateEncodingWriter reads the Accept-Encoding header from a request and
// selects the right compression based on an allow-list of supported
-// compressions. It returns a writer implementing the compression and an the
+// compressions. It returns a writer implementing the compression and the
// correct value that the caller can set in the response header.
func negotiateEncodingWriter(r *http.Request, rw io.Writer, compressions []string) (_ io.Writer, encodingHeaderValue string, closeWriter func(), _ error) {
if len(compressions) == 0 {
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
index d3482c40ca..0248579742 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
@@ -75,10 +75,10 @@ func InstrumentRoundTripperCounter(counter *prometheus.CounterVec, next http.Rou
resp, err := next.RoundTrip(r)
if err == nil {
l := labels(code, method, r.Method, resp.StatusCode, rtOpts.extraMethods...)
- for label, resolve := range rtOpts.extraLabelsFromCtx {
- l[label] = resolve(resp.Request.Context())
+ for label, resolve := range rtOpts.extraLabelsFromRequest {
+ l[label] = resolve(resp.Request)
}
- addWithExemplar(counter.With(l), 1, rtOpts.getExemplarFn(r.Context()))
+ addWithExemplar(counter.With(l), 1, rtOpts.getExemplarFn(r))
}
return resp, err
}
@@ -119,10 +119,10 @@ func InstrumentRoundTripperDuration(obs prometheus.ObserverVec, next http.RoundT
resp, err := next.RoundTrip(r)
if err == nil {
l := labels(code, method, r.Method, resp.StatusCode, rtOpts.extraMethods...)
- for label, resolve := range rtOpts.extraLabelsFromCtx {
- l[label] = resolve(resp.Request.Context())
+ for label, resolve := range rtOpts.extraLabelsFromRequest {
+ l[label] = resolve(resp.Request)
}
- observeWithExemplar(obs.With(l), time.Since(start).Seconds(), rtOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), time.Since(start).Seconds(), rtOpts.getExemplarFn(r))
}
return resp, err
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
index 9332b0249a..9dec091ac7 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
@@ -28,24 +28,36 @@ import (
// magicString is used for the hacky label test in checkLabels. Remove once fixed.
const magicString = "zZgWfBxLqvG8kc8IMv3POi2Bb0tZI3vAnBx+gBaFi9FyPzB/CzKUer1yufDa"
-// observeWithExemplar is a wrapper for [prometheus.ExemplarAdder.ExemplarObserver],
-// which falls back to [prometheus.Observer.Observe] if no labels are provided.
+// observeWithExemplar records val on obs. If labels is non-nil and obs
+// implements [prometheus.ExemplarObserver], the exemplar is attached via
+// ObserveWithExemplar; otherwise the exemplar is dropped and the value is
+// recorded with a plain [prometheus.Observer.Observe]. This mirrors the
+// safe-cast pattern in [prometheus.Timer.ObserveDurationWithExemplar] and
+// ensures we never panic when callers pass an ObserverVec backed by a
+// summary, which cannot carry exemplars in the Prometheus exposition format.
func observeWithExemplar(obs prometheus.Observer, val float64, labels map[string]string) {
- if labels == nil {
- obs.Observe(val)
- return
+ if labels != nil {
+ if eo, ok := obs.(prometheus.ExemplarObserver); ok {
+ eo.ObserveWithExemplar(val, labels)
+ return
+ }
}
- obs.(prometheus.ExemplarObserver).ObserveWithExemplar(val, labels)
+ obs.Observe(val)
}
-// addWithExemplar is a wrapper for [prometheus.ExemplarAdder.AddWithExemplar],
-// which falls back to [prometheus.Counter.Add] if no labels are provided.
-func addWithExemplar(obs prometheus.Counter, val float64, labels map[string]string) {
- if labels == nil {
- obs.Add(val)
- return
+// addWithExemplar records val on c. If labels is non-nil and c implements
+// [prometheus.ExemplarAdder], the exemplar is attached via AddWithExemplar;
+// otherwise the exemplar is dropped and the value is recorded with a plain
+// [prometheus.Counter.Add]. The safe-cast keeps the helper robust against
+// custom Counter implementations that do not advertise exemplar support.
+func addWithExemplar(c prometheus.Counter, val float64, labels map[string]string) {
+ if labels != nil {
+ if ea, ok := c.(prometheus.ExemplarAdder); ok {
+ ea.AddWithExemplar(val, labels)
+ return
+ }
}
- obs.(prometheus.ExemplarAdder).AddWithExemplar(val, labels)
+ c.Add(val)
}
// InstrumentHandlerInFlight is a middleware that wraps the provided
@@ -97,10 +109,10 @@ func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler, op
next.ServeHTTP(d, r)
l := labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- observeWithExemplar(obs.With(l), time.Since(now).Seconds(), hOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), time.Since(now).Seconds(), hOpts.getExemplarFn(r))
}
}
@@ -108,10 +120,10 @@ func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler, op
now := time.Now()
next.ServeHTTP(w, r)
l := labels(code, method, r.Method, 0, hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- observeWithExemplar(obs.With(l), time.Since(now).Seconds(), hOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), time.Since(now).Seconds(), hOpts.getExemplarFn(r))
}
}
@@ -147,10 +159,10 @@ func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler,
next.ServeHTTP(d, r)
l := labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- addWithExemplar(counter.With(l), 1, hOpts.getExemplarFn(r.Context()))
+ addWithExemplar(counter.With(l), 1, hOpts.getExemplarFn(r))
}
}
@@ -158,10 +170,10 @@ func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler,
next.ServeHTTP(w, r)
l := labels(code, method, r.Method, 0, hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- addWithExemplar(counter.With(l), 1, hOpts.getExemplarFn(r.Context()))
+ addWithExemplar(counter.With(l), 1, hOpts.getExemplarFn(r))
}
}
@@ -200,10 +212,10 @@ func InstrumentHandlerTimeToWriteHeader(obs prometheus.ObserverVec, next http.Ha
now := time.Now()
d := newDelegator(w, func(status int) {
l := labels(code, method, r.Method, status, hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- observeWithExemplar(obs.With(l), time.Since(now).Seconds(), hOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), time.Since(now).Seconds(), hOpts.getExemplarFn(r))
})
next.ServeHTTP(d, r)
}
@@ -244,10 +256,10 @@ func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler,
size := computeApproximateRequestSize(r)
l := labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- observeWithExemplar(obs.With(l), float64(size), hOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), float64(size), hOpts.getExemplarFn(r))
}
}
@@ -256,10 +268,10 @@ func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler,
size := computeApproximateRequestSize(r)
l := labels(code, method, r.Method, 0, hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- observeWithExemplar(obs.With(l), float64(size), hOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), float64(size), hOpts.getExemplarFn(r))
}
}
@@ -296,10 +308,10 @@ func InstrumentHandlerResponseSize(obs prometheus.ObserverVec, next http.Handler
next.ServeHTTP(d, r)
l := labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)
- for label, resolve := range hOpts.extraLabelsFromCtx {
- l[label] = resolve(r.Context())
+ for label, resolve := range hOpts.extraLabelsFromRequest {
+ l[label] = resolve(r)
}
- observeWithExemplar(obs.With(l), float64(d.Written()), hOpts.getExemplarFn(r.Context()))
+ observeWithExemplar(obs.With(l), float64(d.Written()), hOpts.getExemplarFn(r))
})
}
@@ -366,7 +378,7 @@ func checkLabels(c prometheus.Collector) (code, method bool) {
panic("metric partitioned with non-supported labels")
}
}
- return
+ return code, method
}
func isLabelCurried(c prometheus.Collector, label string) bool {
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/option.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/option.go
index 5d4383aa14..d4c0954f36 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/option.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/option.go
@@ -15,6 +15,7 @@ package promhttp
import (
"context"
+ "net/http"
"github.com/prometheus/client_golang/prometheus"
)
@@ -24,28 +25,31 @@ type Option interface {
apply(*options)
}
+// LabelValueFromRequest is used to compute the label value from request.
+type LabelValueFromRequest func(request *http.Request) string
+
// LabelValueFromCtx are used to compute the label value from request context.
// Context can be filled with values from request through middleware.
type LabelValueFromCtx func(ctx context.Context) string
// options store options for both a handler or round tripper.
type options struct {
- extraMethods []string
- getExemplarFn func(requestCtx context.Context) prometheus.Labels
- extraLabelsFromCtx map[string]LabelValueFromCtx
+ extraMethods []string
+ getExemplarFn func(req *http.Request) prometheus.Labels
+ extraLabelsFromRequest map[string]LabelValueFromRequest
}
func defaultOptions() *options {
return &options{
- getExemplarFn: func(ctx context.Context) prometheus.Labels { return nil },
- extraLabelsFromCtx: map[string]LabelValueFromCtx{},
+ getExemplarFn: func(req *http.Request) prometheus.Labels { return nil },
+ extraLabelsFromRequest: map[string]LabelValueFromRequest{},
}
}
func (o *options) emptyDynamicLabels() prometheus.Labels {
labels := prometheus.Labels{}
- for label := range o.extraLabelsFromCtx {
+ for label := range o.extraLabelsFromRequest {
labels[label] = ""
}
@@ -66,19 +70,39 @@ func WithExtraMethods(methods ...string) Option {
})
}
-// WithExemplarFromContext allows to inject function that will get exemplar from context that will be put to counter and histogram metrics.
+// WithExemplarFromRequest allows you to inject a function that will get exemplar from request that will be put to counter and histogram metrics.
// If the function returns nil labels or the metric does not support exemplars, no exemplar will be added (noop), but
// metric will continue to observe/increment.
-func WithExemplarFromContext(getExemplarFn func(requestCtx context.Context) prometheus.Labels) Option {
+func WithExemplarFromRequest(getExemplarFn func(req *http.Request) prometheus.Labels) Option {
return optionApplyFunc(func(o *options) {
o.getExemplarFn = getExemplarFn
})
}
+// WithExemplarFromContext allows you to inject a function that will get exemplar from context that will be put to counter and histogram metrics.
+// If the function returns nil labels or the metric does not support exemplars, no exemplar will be added (noop), but
+// metric will continue to observe/increment.
+func WithExemplarFromContext(getExemplarFn func(requestCtx context.Context) prometheus.Labels) Option {
+ return optionApplyFunc(func(o *options) {
+ o.getExemplarFn = func(req *http.Request) prometheus.Labels {
+ return getExemplarFn(req.Context())
+ }
+ })
+}
+
+// WithLabelFromRequest registers a label for dynamic resolution with access to the request.
+func WithLabelFromRequest(name string, valueFn LabelValueFromRequest) Option {
+ return optionApplyFunc(func(o *options) {
+ o.extraLabelsFromRequest[name] = valueFn
+ })
+}
+
// WithLabelFromCtx registers a label for dynamic resolution with access to context.
// See the example for ExampleInstrumentHandlerWithLabelResolver for example usage
func WithLabelFromCtx(name string, valueFn LabelValueFromCtx) Option {
return optionApplyFunc(func(o *options) {
- o.extraLabelsFromCtx[name] = valueFn
+ o.extraLabelsFromRequest[name] = func(req *http.Request) string {
+ return valueFn(req.Context())
+ }
})
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go
index c6fd2f58b7..ed0681c8b4 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go
@@ -214,6 +214,19 @@ func (err AlreadyRegisteredError) Error() string {
// by a Gatherer to report multiple errors during MetricFamily gathering.
type MultiError []error
+// SafeMultiError is a thread-safe wrapper around MultiError using a mutex.
+type SafeMultiError struct {
+ mu sync.Mutex
+ errs MultiError
+}
+
+// Appends the provided error to the contained MultiError in a thread-safe way.
+func (s *SafeMultiError) Append(err error) {
+ s.mu.Lock()
+ s.errs.Append(err)
+ s.mu.Unlock()
+}
+
// Error formats the contained errors as a bullet point list, preceded by the
// total number of errors. Note that this results in a multi-line string.
func (errs MultiError) Error() string {
@@ -408,6 +421,16 @@ func (r *Registry) MustRegister(cs ...Collector) {
}
}
+// MustGather implements Gatherer.
+// Wraps around Gather and panics if Gather fails for any reason.
+func (r *Registry) MustGather() []*dto.MetricFamily {
+ mfs, err := r.Gather()
+ if err != nil {
+ panic(err)
+ }
+ return mfs
+}
+
// Gather implements Gatherer.
func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
r.mtx.RLock()
@@ -423,7 +446,7 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
uncheckedMetricChan = make(chan Metric, capMetricChan)
metricHashes = map[uint64]struct{}{}
wg sync.WaitGroup
- errs MultiError // The collected errors to return in the end.
+ safeErrs = &SafeMultiError{} // To collect errors in a threadsafe way
registeredDescIDs map[uint64]struct{} // Only used for pedantic checks
)
@@ -453,9 +476,9 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
for {
select {
case collector := <-checkedCollectors:
- collector.Collect(checkedMetricChan)
+ safeErrs.Append((safeCollect(collector, checkedMetricChan)))
case collector := <-uncheckedCollectors:
- collector.Collect(uncheckedMetricChan)
+ safeErrs.Append(safeCollect(collector, uncheckedMetricChan))
default:
return
}
@@ -499,7 +522,7 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
cmc = nil
break
}
- errs.Append(processMetric(
+ safeErrs.Append(processMetric(
metric, metricFamiliesByName,
metricHashes,
registeredDescIDs,
@@ -509,7 +532,7 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
umc = nil
break
}
- errs.Append(processMetric(
+ safeErrs.Append(processMetric(
metric, metricFamiliesByName,
metricHashes,
nil,
@@ -526,7 +549,7 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
cmc = nil
break
}
- errs.Append(processMetric(
+ safeErrs.Append(processMetric(
metric, metricFamiliesByName,
metricHashes,
registeredDescIDs,
@@ -536,7 +559,7 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
umc = nil
break
}
- errs.Append(processMetric(
+ safeErrs.Append(processMetric(
metric, metricFamiliesByName,
metricHashes,
nil,
@@ -556,7 +579,8 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
break
}
}
- return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
+
+ return internal.NormalizeMetricFamilies(metricFamiliesByName), safeErrs.errs.MaybeUnwrap()
}
// Describe implements Collector.
@@ -571,6 +595,24 @@ func (r *Registry) Describe(ch chan<- *Desc) {
}
}
+// Helper wrapper around Collector.Collect.
+// It tries to collect from the channel, recovers on panic and
+// if it has recovered from a panic, then it sends an InvalidMetric into
+// the channel with an InvalidDesc, and an error that includes a stack trace.
+func safeCollect(c Collector, ch chan<- Metric) (err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ buf := make([]byte, 64<<10) // 64 KB
+ n := runtime.Stack(buf, false)
+ err = fmt.Errorf("prometheus collector panic recovered: type=%T: error=%v\nstack trace=%s", c, r, buf[:n])
+ ch <- NewInvalidMetric(NewInvalidDesc(err), err)
+ }
+ }()
+ c.Collect(ch)
+
+ return err
+}
+
// Collect implements Collector.
func (r *Registry) Collect(ch chan<- Metric) {
r.mtx.RLock()
@@ -599,10 +641,12 @@ func WriteToTextfile(filename string, g Gatherer) error {
mfs, err := g.Gather()
if err != nil {
+ tmp.Close()
return err
}
for _, mf := range mfs {
if _, err := expfmt.MetricFamilyToText(tmp, mf); err != nil {
+ tmp.Close()
return err
}
}
@@ -685,6 +729,9 @@ func processMetric(
metricFamily = &dto.MetricFamily{}
metricFamily.Name = proto.String(desc.fqName)
metricFamily.Help = proto.String(desc.help)
+ if desc.unit != "" {
+ metricFamily.Unit = proto.String(desc.unit)
+ }
// TODO(beorn7): Simplify switch once Desc has type.
switch {
case dtoMetric.Gauge != nil:
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go
index ac5203c6fa..c12b8d13d4 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/summary.go
@@ -101,6 +101,9 @@ type SummaryOpts struct {
// string.
Help string
+ // Unit provides the unit of this Summary.
+ Unit string
+
// ConstLabels are used to attach fixed labels to this metric. Metrics
// with the same fully-qualified name must have the same label names in
// their ConstLabels.
@@ -181,11 +184,12 @@ type SummaryVecOpts struct {
// NewSummary creates a new Summary based on the provided SummaryOpts.
func NewSummary(opts SummaryOpts) Summary {
return newSummary(
- NewDesc(
+ V2.NewDesc(
BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
opts.Help,
- nil,
+ UnconstrainedLabels(nil),
opts.ConstLabels,
+ WithUnit(opts.Unit),
),
opts,
)
@@ -578,6 +582,7 @@ func (v2) NewSummaryVec(opts SummaryVecOpts) *SummaryVec {
opts.Help,
opts.VariableLabels,
opts.ConstLabels,
+ WithUnit(opts.Unit),
)
return &SummaryVec{
MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer.go b/vendor/github.com/prometheus/client_golang/prometheus/timer.go
index 52344fef53..c1318ffb51 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/timer.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/timer.go
@@ -37,10 +37,10 @@ type Timer struct {
// or
//
// func TimeMeWithExemplar() {
-// timer := NewTimer(myHistogram)
-// defer timer.ObserveDurationWithExemplar(exemplar)
-// // Do actual work.
-// }
+// timer := NewTimer(myHistogram)
+// defer timer.ObserveDurationWithExemplar(exemplar)
+// // Do actual work.
+// }
func NewTimer(o Observer) *Timer {
return &Timer{
begin: time.Now(),
@@ -66,7 +66,7 @@ func (t *Timer) ObserveDuration() time.Duration {
// ObserveDurationWithExemplar is like ObserveDuration, but it will also
// observe exemplar with the duration unless exemplar is nil or provided Observer can't
-// be casted to ExemplarObserver.
+// be cast to ExemplarObserver.
func (t *Timer) ObserveDurationWithExemplar(exemplar Labels) time.Duration {
d := time.Since(t.begin)
eo, ok := t.observer.(ExemplarObserver)
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go
index 487b466563..121d2a9639 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/vec.go
@@ -193,9 +193,11 @@ func (m *MetricVec) CurryWith(labels Labels) (*MetricVec, error) {
//
// Keeping the Metric for later use is possible (and should be considered if
// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Metric from the MetricVec. In that case, the
-// Metric will still exist, but it will not be exported anymore, even if a
-// Metric with the same label values is created later.
+// Delete can be used to delete the Metric from the MetricVec. In that case, if
+// you have previously kept a reference to that Metric, the Metric object still
+// exists and can be used, but it will not be exported anymore. If a Metric with
+// the same label values is created later, updates to the old Metric reference
+// will not be exported.
//
// An error is returned if the number of label values is not the same as the
// number of variable labels in Desc (minus any curried labels).
@@ -657,7 +659,7 @@ func inlineLabelValues(lvs []string, curry []curriedLabelValue) []string {
}
var labelsPool = &sync.Pool{
- New: func() interface{} {
+ New: func() any {
return make(Labels)
},
}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
index 2ed1285068..697f55558b 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
@@ -230,6 +230,7 @@ func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc {
return &Desc{
fqName: desc.fqName,
help: desc.help,
+ unit: desc.unit,
variableLabels: desc.variableLabels,
constLabelPairs: desc.constLabelPairs,
err: fmt.Errorf("attempted wrapping with already existing label name %q", ln),
@@ -238,8 +239,8 @@ func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc {
constLabels[ln] = lv
}
// NewDesc will do remaining validations.
- newDesc := V2.NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels)
- // Propagate errors if there was any. This will override any errer
+ newDesc := V2.NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels, WithUnit(desc.unit))
+ // Propagate errors if there was any. This will override any error
// created by NewDesc above, i.e. earlier errors get precedence.
if desc.err != nil {
newDesc.err = desc.err
diff --git a/vendor/github.com/prometheus/procfs/net_wireless.go b/vendor/github.com/prometheus/procfs/net_wireless.go
index 69d0794451..f74dd3bed0 100644
--- a/vendor/github.com/prometheus/procfs/net_wireless.go
+++ b/vendor/github.com/prometheus/procfs/net_wireless.go
@@ -114,47 +114,47 @@ func parseWireless(r io.Reader) ([]*Wireless, error) {
qlink, err := strconv.Atoi(strings.TrimSuffix(stats[1], "."))
if err != nil {
- return nil, fmt.Errorf("%w: parse Quality:link as integer %q: %w", ErrFileParse, qlink, err)
+ return nil, fmt.Errorf("%w: parse Quality:link as integer %q: %w", ErrFileParse, stats[1], err)
}
qlevel, err := strconv.Atoi(strings.TrimSuffix(stats[2], "."))
if err != nil {
- return nil, fmt.Errorf("%w: Quality:level as integer %q: %w", ErrFileParse, qlevel, err)
+ return nil, fmt.Errorf("%w: Quality:level as integer %q: %w", ErrFileParse, stats[2], err)
}
qnoise, err := strconv.Atoi(strings.TrimSuffix(stats[3], "."))
if err != nil {
- return nil, fmt.Errorf("%w: Quality:noise as integer %q: %w", ErrFileParse, qnoise, err)
+ return nil, fmt.Errorf("%w: Quality:noise as integer %q: %w", ErrFileParse, stats[3], err)
}
dnwid, err := strconv.Atoi(stats[4])
if err != nil {
- return nil, fmt.Errorf("%w: Discarded:nwid as integer %q: %w", ErrFileParse, dnwid, err)
+ return nil, fmt.Errorf("%w: Discarded:nwid as integer %q: %w", ErrFileParse, stats[4], err)
}
dcrypt, err := strconv.Atoi(stats[5])
if err != nil {
- return nil, fmt.Errorf("%w: Discarded:crypt as integer %q: %w", ErrFileParse, dcrypt, err)
+ return nil, fmt.Errorf("%w: Discarded:crypt as integer %q: %w", ErrFileParse, stats[5], err)
}
dfrag, err := strconv.Atoi(stats[6])
if err != nil {
- return nil, fmt.Errorf("%w: Discarded:frag as integer %q: %w", ErrFileParse, dfrag, err)
+ return nil, fmt.Errorf("%w: Discarded:frag as integer %q: %w", ErrFileParse, stats[6], err)
}
dretry, err := strconv.Atoi(stats[7])
if err != nil {
- return nil, fmt.Errorf("%w: Discarded:retry as integer %q: %w", ErrFileParse, dretry, err)
+ return nil, fmt.Errorf("%w: Discarded:retry as integer %q: %w", ErrFileParse, stats[7], err)
}
dmisc, err := strconv.Atoi(stats[8])
if err != nil {
- return nil, fmt.Errorf("%w: Discarded:misc as integer %q: %w", ErrFileParse, dmisc, err)
+ return nil, fmt.Errorf("%w: Discarded:misc as integer %q: %w", ErrFileParse, stats[8], err)
}
mbeacon, err := strconv.Atoi(stats[9])
if err != nil {
- return nil, fmt.Errorf("%w: Missed:beacon as integer %q: %w", ErrFileParse, mbeacon, err)
+ return nil, fmt.Errorf("%w: Missed:beacon as integer %q: %w", ErrFileParse, stats[9], err)
}
w := &Wireless{
diff --git a/vendor/github.com/prometheus/procfs/proc_cgroup.go b/vendor/github.com/prometheus/procfs/proc_cgroup.go
index 535c08d6fc..7e8a122978 100644
--- a/vendor/github.com/prometheus/procfs/proc_cgroup.go
+++ b/vendor/github.com/prometheus/procfs/proc_cgroup.go
@@ -60,7 +60,7 @@ func parseCgroupString(cgroupStr string) (*Cgroup, error) {
}
cgroup.HierarchyID, err = strconv.Atoi(fields[0])
if err != nil {
- return nil, fmt.Errorf("%w: hierarchy ID: %q", ErrFileParse, cgroup.HierarchyID)
+ return nil, fmt.Errorf("%w: hierarchy ID: %q", ErrFileParse, fields[0])
}
if fields[1] != "" {
ssNames := strings.Split(fields[1], ",")
diff --git a/vendor/github.com/sassoftware/relic/lib/pkcs7/attributes.go b/vendor/github.com/sassoftware/relic/lib/pkcs7/attributes.go
deleted file mode 100644
index 0a2d801f5b..0000000000
--- a/vendor/github.com/sassoftware/relic/lib/pkcs7/attributes.go
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// Copyright (c) SAS Institute Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package pkcs7
-
-import (
- "encoding/asn1"
- "fmt"
-)
-
-type ErrNoAttribute struct {
- ID asn1.ObjectIdentifier
-}
-
-func (e ErrNoAttribute) Error() string {
- return fmt.Sprintf("attribute not found: %s", e.ID)
-}
-
-// marshal authenticated attributes for digesting
-func (l *AttributeList) Bytes() ([]byte, error) {
- // needs an explicit SET OF tag but not the class-specific tag from the
- // original struct. see RFC 2315 9.3, 2nd paragraph
- encoded, err := asn1.Marshal(struct {
- A []Attribute `asn1:"set"`
- }{A: *l})
- if err != nil {
- return nil, err
- }
- var raw asn1.RawValue
- if _, err := asn1.Unmarshal(encoded, &raw); err != nil {
- return nil, err
- }
- return raw.Bytes, nil
-}
-
-// unmarshal a single attribute, if it exists
-func (l *AttributeList) GetOne(oid asn1.ObjectIdentifier, dest interface{}) error {
- for _, raw := range *l {
- if !raw.Type.Equal(oid) {
- continue
- }
- rest, err := asn1.Unmarshal(raw.Values.Bytes, dest)
- if err != nil {
- return err
- } else if len(rest) != 0 {
- return fmt.Errorf("attribute %s: expected one, found multiple", oid)
- } else {
- return nil
- }
- }
- return ErrNoAttribute{oid}
-}
-
-// create or append to an attribute
-func (l *AttributeList) Add(oid asn1.ObjectIdentifier, obj interface{}) error {
- value, err := asn1.Marshal(obj)
- if err != nil {
- return err
- }
- for _, attr := range *l {
- if attr.Type.Equal(oid) {
- attr.Values.Bytes = append(attr.Values.Bytes, value...)
- return nil
- }
- }
- *l = append(*l, Attribute{
- Type: oid,
- Values: asn1.RawValue{
- Class: asn1.ClassUniversal,
- Tag: asn1.TagSet,
- IsCompound: true,
- Bytes: value,
- }})
- return nil
-}
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/names.go b/vendor/github.com/sassoftware/relic/lib/x509tools/names.go
deleted file mode 100644
index 8b8461d131..0000000000
--- a/vendor/github.com/sassoftware/relic/lib/x509tools/names.go
+++ /dev/null
@@ -1,214 +0,0 @@
-//
-// Copyright (c) SAS Institute Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package x509tools
-
-import (
- "crypto/x509"
- "encoding/asn1"
- "encoding/binary"
- "fmt"
- "strings"
- "unicode/utf16"
-)
-
-type rdnAttr struct {
- Type asn1.ObjectIdentifier
- Value asn1.RawValue
-}
-
-type rdnNameSet []rdnAttr
-
-type NameStyle int
-
-const (
- NameStyleOpenSsl NameStyle = iota
- NameStyleLdap
- NameStyleMsOsco
-)
-
-type attrName struct {
- Type asn1.ObjectIdentifier
- Name string
-}
-
-var nameStyleLdap = []attrName{
- attrName{asn1.ObjectIdentifier{2, 5, 4, 3}, "CN"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 4}, "surname"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 5}, "serialNumber"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 6}, "C"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 7}, "L"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 8}, "ST"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 9}, "street"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 10}, "O"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 11}, "OU"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 12}, "title"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 13}, "description"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 17}, "postalCode"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 18}, "postOfficeBox"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 20}, "telephoneNumber"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 42}, "givenName"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 43}, "initials"},
- attrName{asn1.ObjectIdentifier{0, 9, 2342, 19200300, 100, 1, 25}, "dc"},
- attrName{asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, "emailAddress"},
-}
-
-// Per [MS-OSCO]
-// https://msdn.microsoft.com/en-us/library/dd947276(v=office.12).aspx
-var nameStyleMsOsco = []attrName{
- attrName{asn1.ObjectIdentifier{2, 5, 4, 3}, "CN"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 7}, "L"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 10}, "O"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 11}, "OU"},
- attrName{asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, "E"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 6}, "C"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 8}, "S"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 9}, "STREET"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 12}, "T"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 42}, "G"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 43}, "I"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 4}, "SN"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 5}, "SERIALNUMBER"},
- attrName{asn1.ObjectIdentifier{0, 9, 2342, 19200300, 100, 1, 25}, "DC"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 13}, "Description"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 17}, "PostalCode"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 18}, "POBox"},
- attrName{asn1.ObjectIdentifier{2, 5, 4, 20}, "Phone"},
-}
-
-// returned by the Format* functions in case there's something cripplingly
-// wrong with it
-const InvalidName = ""
-
-// Format the name (RDN sequence) from its raw DER to a readable style.
-func FormatPkixName(der []byte, style NameStyle) string {
- var seq asn1.RawValue
- if _, err := asn1.Unmarshal(der, &seq); err != nil {
- return InvalidName
- }
- seqbytes := seq.Bytes
- var formatted []string
- for len(seqbytes) > 0 {
- var rdnSet rdnNameSet
- var err error
- seqbytes, err = asn1.UnmarshalWithParams(seqbytes, &rdnSet, "set")
- if err != nil {
- return InvalidName
- }
- for _, attr := range rdnSet {
- formatted = append(formatted, fmt.Sprintf("%s=%s", attName(attr.Type, style), attValue(attr.Value, style)))
- }
- }
- if len(formatted) == 0 {
- return ""
- }
- switch style {
- case NameStyleOpenSsl:
- return "/" + strings.Join(formatted, "/") + "/"
- case NameStyleLdap, NameStyleMsOsco:
- // Per RFC 2253 2.1, reverse the order
- for i := 0; i < len(formatted)/2; i++ {
- j := len(formatted) - i - 1
- formatted[i], formatted[j] = formatted[j], formatted[i]
- }
- return strings.Join(formatted, ", ")
- default:
- panic("invalid style argument")
- }
-}
-
-func attName(t asn1.ObjectIdentifier, style NameStyle) string {
- var names []attrName
- var defaultPrefix string
- switch style {
- case NameStyleLdap, NameStyleOpenSsl:
- names = nameStyleLdap
- case NameStyleMsOsco:
- names = nameStyleMsOsco
- defaultPrefix = "OID."
- default:
- panic("invalid style argument")
- }
- for _, name := range names {
- if name.Type.Equal(t) {
- return name.Name
- }
- }
- return defaultPrefix + t.String()
-}
-
-func attValue(raw asn1.RawValue, style NameStyle) string {
- var value string
- switch raw.Tag {
- case asn1.TagUTF8String, asn1.TagIA5String, asn1.TagPrintableString:
- var ret interface{}
- if _, err := asn1.Unmarshal(raw.FullBytes, &ret); err != nil {
- return InvalidName
- }
- value = ret.(string)
- case Asn1TagBMPString:
- value = ParseBMPString(raw)
- default:
- return InvalidName
- }
- switch style {
- case NameStyleOpenSsl:
- value = strings.Replace(value, "/", "\\/", -1)
- case NameStyleLdap, NameStyleMsOsco:
- quote := false
- if len(value) == 0 {
- quote = true
- }
- if strings.HasPrefix(value, " ") || strings.HasSuffix(value, " ") {
- quote = true
- }
- if i := strings.IndexAny(value, ",+=\n<>#;'\""); i >= 0 {
- quote = true
- }
- value = strings.Replace(value, "\"", "\"\"", -1)
- if quote {
- value = "\"" + value + "\""
- }
- }
- return value
-}
-
-func ParseBMPString(raw asn1.RawValue) string {
- runes := make([]uint16, len(raw.Bytes)/2)
- for i := range runes {
- runes[i] = binary.BigEndian.Uint16(raw.Bytes[i*2:])
- }
- return string(utf16.Decode(runes))
-}
-
-func ToBMPString(value string) asn1.RawValue {
- runes := utf16.Encode([]rune(value))
- raw := make([]byte, 2*len(runes))
- for i, r := range runes {
- binary.BigEndian.PutUint16(raw[i*2:], r)
- }
- return asn1.RawValue{Tag: Asn1TagBMPString, Bytes: raw}
-}
-
-// Format the certificate subject name in LDAP style
-func FormatSubject(cert *x509.Certificate) string {
- return FormatPkixName(cert.RawSubject, NameStyleLdap)
-}
-
-// Format the certificate issuer name in LDAP style
-func FormatIssuer(cert *x509.Certificate) string {
- return FormatPkixName(cert.RawIssuer, NameStyleLdap)
-}
diff --git a/vendor/github.com/sassoftware/relic/v8/LICENSE b/vendor/github.com/sassoftware/relic/v8/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/vendor/github.com/sassoftware/relic/v8/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/attributes.go b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/attributes.go
new file mode 100644
index 0000000000..3558a2fe10
--- /dev/null
+++ b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/attributes.go
@@ -0,0 +1,152 @@
+//
+// Copyright (c) SAS Institute Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package pkcs7
+
+import (
+ "encoding/asn1"
+ "errors"
+ "fmt"
+ "time"
+)
+
+type ErrNoAttribute struct {
+ ID asn1.ObjectIdentifier
+}
+
+func (e ErrNoAttribute) Error() string {
+ return fmt.Sprintf("attribute not found: %s", e.ID)
+}
+
+// Bytes returns a SET OF form of the attribute list for digesting, per RFC 2315 9.3, 2nd paragraph
+func (l *AttributeList) Bytes() ([]byte, error) {
+ return marshalUnsortedSet(*l)
+}
+
+// Need to marshal authenticated attributes as a SET OF in order to digest them,
+// but since go 1.15 sets get sorted which breaks the digest. Marshal as a
+// sequence and then change the tag.
+func marshalUnsortedSet(v interface{}) ([]byte, error) {
+ encoded, err := asn1.Marshal(v)
+ if err != nil {
+ return nil, err
+ }
+ if len(encoded) > 0 {
+ if encoded[0]&0x1f != asn1.TagSequence {
+ return nil, fmt.Errorf("expected sequence, got %d", encoded[0]&0x1f)
+ }
+ // sequence 16 -> set 17
+ encoded[0] |= 1
+ }
+ return encoded, nil
+}
+
+// GetOne unmarshals a single attribute, if it exists
+func (l *AttributeList) GetOne(oid asn1.ObjectIdentifier, dest interface{}) error {
+ for _, raw := range *l {
+ if !raw.Type.Equal(oid) {
+ continue
+ }
+ rest, err := asn1.Unmarshal(raw.Values.Bytes, dest)
+ if err != nil {
+ return err
+ } else if len(rest) != 0 {
+ return fmt.Errorf("attribute %s: expected one, found multiple", oid)
+ } else {
+ return nil
+ }
+ }
+ return ErrNoAttribute{oid}
+}
+
+// GetAll unmarshals all values for an attribute. dest should be a pointer to a slice.
+func (l *AttributeList) GetAll(oid asn1.ObjectIdentifier, dest interface{}) error {
+ for _, raw := range *l {
+ if raw.Type.Equal(oid) {
+ _, err := asn1.UnmarshalWithParams(raw.Values.FullBytes, dest, "set")
+ return err
+ }
+ }
+ return ErrNoAttribute{oid}
+}
+
+// create or append to an attribute
+func (l *AttributeList) Add(oid asn1.ObjectIdentifier, obj interface{}) error {
+ value, err := asn1.Marshal(obj)
+ if err != nil {
+ return err
+ }
+ *l = appendAttr(*l, oid, value)
+ return nil
+}
+
+func appendAttr(attrList AttributeList, oid asn1.ObjectIdentifier, value []byte) AttributeList {
+ for i, attr := range attrList {
+ if attr.Type.Equal(oid) {
+ attr.Values.Bytes = append(attr.Values.Bytes, value...)
+ attrList[i] = attr
+ return attrList
+ }
+ }
+ return append(attrList, Attribute{
+ Type: oid,
+ Values: asn1.RawValue{
+ Class: asn1.ClassUniversal,
+ Tag: asn1.TagSet,
+ IsCompound: true,
+ Bytes: value,
+ }})
+}
+
+func (l AttributeList) Exists(oid asn1.ObjectIdentifier) bool {
+ for _, attr := range l {
+ if attr.Type.Equal(oid) {
+ return true
+ }
+ }
+ return false
+}
+
+func (i SignerInfo) SigningTime() (time.Time, error) {
+ var raw asn1.RawValue
+ if err := i.AuthenticatedAttributes.GetOne(OidAttributeSigningTime, &raw); err != nil {
+ return time.Time{}, err
+ }
+ return ParseTime(raw)
+}
+
+// AuthenticatedAttributesBytes returns a SET OF form of the attribute list for digesting, per RFC 2315 9.3, 2nd paragraph
+func (i SignerInfo) AuthenticatedAttributesBytes() ([]byte, error) {
+ if i.RawContent == nil {
+ return i.AuthenticatedAttributes.Bytes()
+ }
+ // decode the SignerInfo as a sequence of raw values to extract how the
+ // authenticated attributes were originally encoded extract the original
+ var seq []asn1.RawValue
+ if _, err := asn1.Unmarshal(i.RawContent, &seq); err != nil {
+ return nil, err
+ }
+ if len(seq) < 4 {
+ return nil, errors.New("short sequence in SignerInfo")
+ }
+ raw := seq[3]
+ // tweak the attribute sequence to be a set
+ return marshalUnsortedSet(asn1.RawValue{
+ Tag: asn1.TagSequence,
+ IsCompound: true,
+ Bytes: raw.Bytes,
+ })
+}
diff --git a/vendor/github.com/sassoftware/relic/lib/pkcs7/builder.go b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/builder.go
similarity index 96%
rename from vendor/github.com/sassoftware/relic/lib/pkcs7/builder.go
rename to vendor/github.com/sassoftware/relic/v8/lib/pkcs7/builder.go
index 652f392996..493b9d676f 100644
--- a/vendor/github.com/sassoftware/relic/lib/pkcs7/builder.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/builder.go
@@ -25,12 +25,11 @@ import (
"errors"
"fmt"
- "github.com/sassoftware/relic/lib/x509tools"
+ "github.com/sassoftware/relic/v8/lib/x509tools"
)
type SignatureBuilder struct {
contentInfo ContentInfo
- hash crypto.Hash
digest []byte
certs []*x509.Certificate
privateKey crypto.Signer
@@ -99,7 +98,7 @@ func (sb *SignatureBuilder) Sign() (*ContentInfoSignedData, error) {
pubKey := sb.privateKey.Public()
digestAlg, pkeyAlg, err := x509tools.PkixAlgorithms(pubKey, sb.signerOpts)
if err != nil {
- return nil, fmt.Errorf("pkcs7: %s", err)
+ return nil, fmt.Errorf("pkcs7: %w", err)
}
if len(sb.certs) < 1 || !x509tools.SameKey(pubKey, sb.certs[0].PublicKey) {
return nil, errors.New("pkcs7: first certificate must match private key")
@@ -135,7 +134,7 @@ func (sb *SignatureBuilder) Sign() (*ContentInfoSignedData, error) {
ContentInfo: sb.contentInfo,
Certificates: marshalCertificates(sb.certs),
CRLs: nil,
- SignerInfos: []SignerInfo{SignerInfo{
+ SignerInfos: []SignerInfo{{
Version: 1,
IssuerAndSerialNumber: IssuerAndSerial{
IssuerName: asn1.RawValue{FullBytes: sb.certs[0].RawIssuer},
diff --git a/vendor/github.com/sassoftware/relic/lib/pkcs7/content.go b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/content.go
similarity index 100%
rename from vendor/github.com/sassoftware/relic/lib/pkcs7/content.go
rename to vendor/github.com/sassoftware/relic/v8/lib/pkcs7/content.go
diff --git a/vendor/github.com/sassoftware/relic/lib/pkcs7/marshal.go b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/marshal.go
similarity index 50%
rename from vendor/github.com/sassoftware/relic/lib/pkcs7/marshal.go
rename to vendor/github.com/sassoftware/relic/v8/lib/pkcs7/marshal.go
index 03c0b82b28..4c450391cb 100644
--- a/vendor/github.com/sassoftware/relic/lib/pkcs7/marshal.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/marshal.go
@@ -22,6 +22,7 @@ import (
"encoding/asn1"
"errors"
"fmt"
+ "time"
)
// Parse a signature from bytes
@@ -44,7 +45,7 @@ func (psd *ContentInfoSignedData) Marshal() ([]byte, error) {
func (psd *ContentInfoSignedData) Detach() ([]byte, error) {
content, err := psd.Content.ContentInfo.Bytes()
if err != nil {
- return nil, fmt.Errorf("pkcs7: %s", err)
+ return nil, fmt.Errorf("pkcs7: %w", err)
}
psd.Content.ContentInfo, _ = NewContentInfo(psd.Content.ContentInfo.ContentType, nil)
return content, nil
@@ -52,23 +53,63 @@ func (psd *ContentInfoSignedData) Detach() ([]byte, error) {
// dump raw certificates to structure
func marshalCertificates(certs []*x509.Certificate) RawCertificates {
- var buf bytes.Buffer
- for _, cert := range certs {
- buf.Write(cert.Raw)
+ c := make(RawCertificates, len(certs))
+ for i, cert := range certs {
+ c[i] = asn1.RawValue{FullBytes: cert.Raw}
}
- val := asn1.RawValue{Bytes: buf.Bytes(), Class: 2, Tag: 0, IsCompound: true}
- b, _ := asn1.Marshal(val)
- return RawCertificates{Raw: b}
+ return c
}
-// parse raw certificates from structure
+// Parse raw certificates from structure. If any cert is invalid, the remaining valid certs are returned along with a CertificateError.
func (raw RawCertificates) Parse() ([]*x509.Certificate, error) {
- var val asn1.RawValue
- if len(raw.Raw) == 0 {
- return nil, nil
+ var invalid CertificateError
+ var certs []*x509.Certificate
+ for _, rawCert := range raw {
+ cert, err := x509.ParseCertificate(rawCert.FullBytes)
+ if err != nil {
+ invalid.Invalid = append(invalid.Invalid, rawCert.FullBytes)
+ invalid.Err = err
+ } else {
+ certs = append(certs, cert)
+ }
}
- if _, err := asn1.Unmarshal(raw.Raw, &val); err != nil {
- return nil, err
+ if invalid.Err != nil {
+ return certs, invalid
+ }
+ return certs, nil
+}
+
+type CertificateError struct {
+ Invalid [][]byte
+ Err error
+}
+
+func (c CertificateError) Error() string {
+ return c.Err.Error()
+}
+
+func (c CertificateError) Unwrap() error {
+ return c.Err
+}
+
+// ParseTime parses a GeneralizedTime or UTCTime value that potentially has a fractional seconds part
+func ParseTime(raw asn1.RawValue) (ret time.Time, err error) {
+ // as of go 1.12 fractional timestamps fail to parse with a "did not serialize back to the original value" error, so this implementation without the serialize check is needed
+ s := string(raw.Bytes)
+ switch raw.Tag {
+ case asn1.TagGeneralizedTime:
+ formatStr := "20060102150405Z0700"
+ return time.Parse(formatStr, s)
+ case asn1.TagUTCTime:
+ formatStr := "0601021504Z0700"
+ ret, err = time.Parse(formatStr, s)
+ if err != nil {
+ formatStr = "060102150405Z0700"
+ ret, err = time.Parse(formatStr, s)
+ }
+ return
+ default:
+ err = fmt.Errorf("unknown tag %d in timestamp field", raw.Tag)
+ return
}
- return x509.ParseCertificates(val.Bytes)
}
diff --git a/vendor/github.com/sassoftware/relic/lib/pkcs7/structs.go b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/structs.go
similarity index 97%
rename from vendor/github.com/sassoftware/relic/lib/pkcs7/structs.go
rename to vendor/github.com/sassoftware/relic/v8/lib/pkcs7/structs.go
index 522ed75c22..19d5fcf322 100644
--- a/vendor/github.com/sassoftware/relic/lib/pkcs7/structs.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/structs.go
@@ -58,9 +58,7 @@ type SignedData struct {
SignerInfos []SignerInfo `asn1:"set"`
}
-type RawCertificates struct {
- Raw asn1.RawContent
-}
+type RawCertificates []asn1.RawValue
type Attribute struct {
Type asn1.ObjectIdentifier
@@ -70,6 +68,8 @@ type Attribute struct {
type AttributeList []Attribute
type SignerInfo struct {
+ RawContent asn1.RawContent
+
Version int `asn1:"default:1"`
IssuerAndSerialNumber IssuerAndSerial ``
DigestAlgorithm pkix.AlgorithmIdentifier ``
diff --git a/vendor/github.com/sassoftware/relic/lib/pkcs7/verify.go b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/verify.go
similarity index 77%
rename from vendor/github.com/sassoftware/relic/lib/pkcs7/verify.go
rename to vendor/github.com/sassoftware/relic/v8/lib/pkcs7/verify.go
index 4880731d4c..6f8fa3e038 100644
--- a/vendor/github.com/sassoftware/relic/lib/pkcs7/verify.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/pkcs7/verify.go
@@ -21,17 +21,21 @@ import (
"crypto/hmac"
"crypto/rsa"
"crypto/x509"
+ "encoding/asn1"
+ "errors"
"fmt"
+ "math/big"
"time"
- "github.com/pkg/errors"
- "github.com/sassoftware/relic/lib/x509tools"
+ "github.com/sassoftware/relic/v8/lib/x509tools"
+ "github.com/sassoftware/relic/v8/signers/sigerrors"
)
type Signature struct {
SignerInfo *SignerInfo
Certificate *x509.Certificate
Intermediates []*x509.Certificate
+ CertError error
}
// Verify the content in a SignedData structure. External content may be
@@ -59,20 +63,29 @@ func (sd *SignedData) Verify(externalContent []byte, skipDigests bool) (Signatur
}
}
}
- certs, err := sd.Certificates.Parse()
- if err != nil {
- return Signature{}, fmt.Errorf("pkcs7: %s", err)
- } else if len(certs) == 0 {
- return Signature{}, errors.New("pkcs7: certificate missing from signedData")
+ if len(sd.SignerInfos) == 0 {
+ return Signature{}, sigerrors.NotSignedError{Type: "pkcs7"}
}
+ certs, certErr := sd.Certificates.Parse()
+ // postpone handling of cert parse error until something is actually missing
var cert *x509.Certificate
var sig Signature
for _, si := range sd.SignerInfos {
+ var err error
cert, err = si.Verify(content, skipDigests, certs)
if err != nil {
+ if errors.As(err, &MissingCertificateError{}) && certErr != nil {
+ // now surface the parse error
+ err = certErr
+ }
return Signature{}, err
}
- sig = Signature{&si, cert, certs}
+ sig = Signature{
+ SignerInfo: &si,
+ Certificate: cert,
+ Intermediates: certs,
+ CertError: certErr,
+ }
}
return sig, nil
}
@@ -85,7 +98,17 @@ func (si *SignerInfo) FindCertificate(certs []*x509.Certificate) (*x509.Certific
return cert, nil
}
}
- return nil, errors.New("pkcs7: certificate missing from signedData")
+ return nil, MissingCertificateError{Issuer: is.IssuerName, SerialNumber: is.SerialNumber}
+}
+
+type MissingCertificateError struct {
+ Issuer asn1.RawValue
+ SerialNumber *big.Int
+}
+
+func (e MissingCertificateError) Error() string {
+ name := x509tools.FormatPkixName(e.Issuer.FullBytes, x509tools.NameStyleLdap)
+ return fmt.Sprintf("certificate missing from signedData: serial=%x issuer: %s", e.SerialNumber, name)
}
// Verify the signature contained in this SignerInfo and return the leaf
@@ -93,7 +116,7 @@ func (si *SignerInfo) FindCertificate(certs []*x509.Certificate) (*x509.Certific
func (si *SignerInfo) Verify(content []byte, skipDigests bool, certs []*x509.Certificate) (*x509.Certificate, error) {
hash, err := x509tools.PkixDigestToHashE(si.DigestAlgorithm)
if err != nil {
- return nil, errors.Wrap(err, "pkcs7")
+ return nil, fmt.Errorf("pkcs7: %w", err)
}
var digest []byte
if !skipDigests {
@@ -111,9 +134,9 @@ func (si *SignerInfo) Verify(content []byte, skipDigests bool, certs []*x509.Cer
}
// now pivot to verifying the hash over the authenticated attributes
w := hash.New()
- attrbytes, err := si.AuthenticatedAttributes.Bytes()
+ attrbytes, err := si.AuthenticatedAttributesBytes()
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("verifying authenticated attributes: %w", err)
}
w.Write(attrbytes)
digest = w.Sum(nil)
@@ -158,5 +181,12 @@ func (info Signature) VerifyChain(roots *x509.CertPool, extraCerts []*x509.Certi
KeyUsages: []x509.ExtKeyUsage{usage},
}
_, err := info.Certificate.Verify(opts)
+ if err == nil {
+ return nil
+ }
+ if e := new(x509.UnknownAuthorityError); errors.As(err, e) && info.CertError != nil {
+ // surface a saved cert parse error
+ return fmt.Errorf("%w: after failing to parse a bundled certificate: %s", err, info.CertError)
+ }
return err
}
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/certpool.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/certpool.go
similarity index 86%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/certpool.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/certpool.go
index 771d3509e6..21a610a356 100644
--- a/vendor/github.com/sassoftware/relic/lib/x509tools/certpool.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/certpool.go
@@ -21,6 +21,7 @@ import (
"crypto/x509"
"fmt"
"io/ioutil"
+ "strings"
)
// Load a certificate pool from a file and set it as the root CA for a TLS
@@ -40,9 +41,15 @@ func LoadCertPool(path string, tconf *tls.Config) error {
} else {
tconf.RootCAs = x509.NewCertPool()
}
- contents, err := ioutil.ReadFile(path)
- if err != nil {
- return err
+ var contents []byte
+ if strings.Contains(path, "-----BEGIN") {
+ contents = []byte(path)
+ } else {
+ var err error
+ contents, err = ioutil.ReadFile(path)
+ if err != nil {
+ return err
+ }
}
if !tconf.RootCAs.AppendCertsFromPEM(contents) {
return fmt.Errorf("no CA certificates in %s", path)
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/digests.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/digests.go
similarity index 100%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/digests.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/digests.go
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/ecdsa_curves.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/ecdsa_curves.go
similarity index 93%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/ecdsa_curves.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/ecdsa_curves.go
index 1e3a6fabc8..589a586ac2 100644
--- a/vendor/github.com/sassoftware/relic/lib/x509tools/ecdsa_curves.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/ecdsa_curves.go
@@ -164,7 +164,7 @@ func UnpackEcdsaSignature(packed []byte) (sig EcdsaSignature, err error) {
if len(packed) != byteLen*2 {
err = errors.New("ecdsa signature is incorrect size")
} else {
- sig.R = new(big.Int).SetBytes(packed[:byteLen])
+ sig.R = new(big.Int).SetBytes(packed[0:byteLen])
sig.S = new(big.Int).SetBytes(packed[byteLen:])
}
return
@@ -178,14 +178,15 @@ func (sig EcdsaSignature) Marshal() []byte {
// Pack an ECDSA signature by concatenating the two numbers per IEEE 1363
func (sig EcdsaSignature) Pack() []byte {
- rbytes := sig.R.Bytes()
- sbytes := sig.S.Bytes()
- byteLen := len(rbytes)
- if len(sbytes) > byteLen {
- byteLen = len(sbytes)
+ // allocate space to hold both numbers
+ nbits := sig.R.BitLen()
+ if s := sig.S.BitLen(); s > nbits {
+ nbits = s
}
- ret := make([]byte, byteLen*2)
- copy(ret[byteLen-len(rbytes):], rbytes)
- copy(ret[2*byteLen-len(sbytes):], sbytes)
+ nbytes := (nbits + 7) / 8
+ ret := make([]byte, 2*nbytes)
+ // serialize with padding
+ sig.R.FillBytes(ret[0:nbytes])
+ sig.S.FillBytes(ret[nbytes:])
return ret
}
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/keylogfile.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/keylogfile.go
similarity index 100%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/keylogfile.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/keylogfile.go
diff --git a/vendor/github.com/sassoftware/relic/v8/lib/x509tools/names.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/names.go
new file mode 100644
index 0000000000..4b096c4a62
--- /dev/null
+++ b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/names.go
@@ -0,0 +1,199 @@
+//
+// Copyright (c) SAS Institute Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package x509tools
+
+import (
+ "crypto/x509"
+ "crypto/x509/pkix"
+ "encoding/asn1"
+ "encoding/binary"
+ "fmt"
+ "strings"
+ "unicode/utf16"
+)
+
+type NameStyle int
+
+const (
+ NameStyleOpenSsl NameStyle = iota
+ NameStyleLdap
+ NameStyleMsOsco
+)
+
+type attrName struct {
+ Type asn1.ObjectIdentifier
+ Name string
+}
+
+var nameStyleLdap = []attrName{
+ {asn1.ObjectIdentifier{2, 5, 4, 3}, "CN"},
+ {asn1.ObjectIdentifier{2, 5, 4, 4}, "surname"},
+ {asn1.ObjectIdentifier{2, 5, 4, 5}, "serialNumber"},
+ {asn1.ObjectIdentifier{2, 5, 4, 6}, "C"},
+ {asn1.ObjectIdentifier{2, 5, 4, 7}, "L"},
+ {asn1.ObjectIdentifier{2, 5, 4, 8}, "ST"},
+ {asn1.ObjectIdentifier{2, 5, 4, 9}, "street"},
+ {asn1.ObjectIdentifier{2, 5, 4, 10}, "O"},
+ {asn1.ObjectIdentifier{2, 5, 4, 11}, "OU"},
+ {asn1.ObjectIdentifier{2, 5, 4, 12}, "title"},
+ {asn1.ObjectIdentifier{2, 5, 4, 13}, "description"},
+ {asn1.ObjectIdentifier{2, 5, 4, 17}, "postalCode"},
+ {asn1.ObjectIdentifier{2, 5, 4, 18}, "postOfficeBox"},
+ {asn1.ObjectIdentifier{2, 5, 4, 20}, "telephoneNumber"},
+ {asn1.ObjectIdentifier{2, 5, 4, 42}, "givenName"},
+ {asn1.ObjectIdentifier{2, 5, 4, 43}, "initials"},
+ {asn1.ObjectIdentifier{0, 9, 2342, 19200300, 100, 1, 1}, "UID"},
+ {asn1.ObjectIdentifier{0, 9, 2342, 19200300, 100, 1, 25}, "dc"},
+ {asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, "emailAddress"},
+}
+
+// Per [MS-OSCO]
+// https://msdn.microsoft.com/en-us/library/dd947276(v=office.12).aspx
+var nameStyleMsOsco = []attrName{
+ {asn1.ObjectIdentifier{2, 5, 4, 3}, "CN"},
+ {asn1.ObjectIdentifier{2, 5, 4, 7}, "L"},
+ {asn1.ObjectIdentifier{2, 5, 4, 10}, "O"},
+ {asn1.ObjectIdentifier{2, 5, 4, 11}, "OU"},
+ {asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, "E"},
+ {asn1.ObjectIdentifier{2, 5, 4, 6}, "C"},
+ {asn1.ObjectIdentifier{2, 5, 4, 8}, "S"},
+ {asn1.ObjectIdentifier{2, 5, 4, 9}, "STREET"},
+ {asn1.ObjectIdentifier{2, 5, 4, 12}, "T"},
+ {asn1.ObjectIdentifier{2, 5, 4, 42}, "G"},
+ {asn1.ObjectIdentifier{2, 5, 4, 43}, "I"},
+ {asn1.ObjectIdentifier{2, 5, 4, 4}, "SN"},
+ {asn1.ObjectIdentifier{2, 5, 4, 5}, "SERIALNUMBER"},
+ {asn1.ObjectIdentifier{0, 9, 2342, 19200300, 100, 1, 1}, "UID"},
+ {asn1.ObjectIdentifier{0, 9, 2342, 19200300, 100, 1, 25}, "DC"},
+ {asn1.ObjectIdentifier{2, 5, 4, 13}, "Description"},
+ {asn1.ObjectIdentifier{2, 5, 4, 17}, "PostalCode"},
+ {asn1.ObjectIdentifier{2, 5, 4, 18}, "POBox"},
+ {asn1.ObjectIdentifier{2, 5, 4, 20}, "Phone"},
+}
+
+// returned by the Format* functions in case there's something cripplingly
+// wrong with it
+const InvalidName = ""
+
+// Format the name (RDN sequence) from its raw DER to a readable style.
+func FormatPkixName(der []byte, style NameStyle) string {
+ var seq pkix.RDNSequence
+ if _, err := asn1.Unmarshal(der, &seq); err != nil {
+ return InvalidName
+ }
+ var b strings.Builder
+ if style == NameStyleOpenSsl {
+ for _, rdnSet := range seq {
+ for _, attr := range rdnSet {
+ b.WriteByte('/')
+ b.WriteString(attName(attr.Type, style))
+ b.WriteByte('=')
+ b.WriteString(attValue(attr.Value, style))
+ }
+ }
+ } else {
+ // Per RFC 2253 2.1, reverse the order
+ for i := len(seq) - 1; i >= 0; i-- {
+ if i < len(seq)-1 {
+ b.WriteString(", ")
+ }
+ rdnSet := seq[i]
+ for j, attr := range rdnSet {
+ if j > 0 {
+ b.WriteString(" + ")
+ }
+ b.WriteString(attName(attr.Type, style))
+ b.WriteByte('=')
+ b.WriteString(attValue(attr.Value, style))
+ }
+ }
+ }
+ return b.String()
+}
+
+func attName(t asn1.ObjectIdentifier, style NameStyle) string {
+ var names []attrName
+ var defaultPrefix string
+ switch style {
+ case NameStyleLdap, NameStyleOpenSsl:
+ names = nameStyleLdap
+ case NameStyleMsOsco:
+ names = nameStyleMsOsco
+ defaultPrefix = "OID."
+ default:
+ panic("invalid style argument")
+ }
+ for _, name := range names {
+ if name.Type.Equal(t) {
+ return name.Name
+ }
+ }
+ return defaultPrefix + t.String()
+}
+
+func attValue(raw interface{}, style NameStyle) string {
+ var value string
+ switch v := raw.(type) {
+ case string:
+ value = v
+ case fmt.Stringer:
+ value = v.String()
+ case int64:
+ value = fmt.Sprint(v)
+ default:
+ return InvalidName
+ }
+ switch style {
+ case NameStyleOpenSsl:
+ value = strings.ReplaceAll(value, "/", "\\/")
+ case NameStyleLdap, NameStyleMsOsco:
+ quote := false
+ if len(value) == 0 {
+ quote = true
+ }
+ if strings.HasPrefix(value, " ") || strings.HasSuffix(value, " ") {
+ quote = true
+ }
+ if i := strings.IndexAny(value, ",+=\n<>#;'\""); i >= 0 {
+ quote = true
+ }
+ value = strings.ReplaceAll(value, "\"", "\"\"")
+ if quote {
+ value = "\"" + value + "\""
+ }
+ }
+ return value
+}
+
+func ToBMPString(value string) asn1.RawValue {
+ runes := utf16.Encode([]rune(value))
+ raw := make([]byte, 2*len(runes))
+ for i, r := range runes {
+ binary.BigEndian.PutUint16(raw[i*2:], r)
+ }
+ return asn1.RawValue{Tag: asn1.TagBMPString, Bytes: raw}
+}
+
+// Format the certificate subject name in LDAP style
+func FormatSubject(cert *x509.Certificate) string {
+ return FormatPkixName(cert.RawSubject, NameStyleLdap)
+}
+
+// Format the certificate issuer name in LDAP style
+func FormatIssuer(cert *x509.Certificate) string {
+ return FormatPkixName(cert.RawIssuer, NameStyleLdap)
+}
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/pkix.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/pkix.go
similarity index 94%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/pkix.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/pkix.go
index 691c189b3e..e436571619 100644
--- a/vendor/github.com/sassoftware/relic/lib/x509tools/pkix.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/pkix.go
@@ -33,7 +33,6 @@ var (
OidPublicKeyDSA = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 1}
OidPublicKeyECDSA = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1}
- oidSignatureMD2WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 2}
oidSignatureMD5WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 4}
oidSignatureSHA1WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5}
oidSignatureSHA256WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11}
@@ -51,7 +50,12 @@ var (
OidMGF1 = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 8}
OidSignatureRSAPSS = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 10}
- Asn1TagBMPString = 30
+ oidExtensionSubjectKeyId = asn1.ObjectIdentifier{2, 5, 29, 14}
+ oidExtensionKeyUsage = asn1.ObjectIdentifier{2, 5, 29, 15}
+ oidExtensionSubjectAltName = asn1.ObjectIdentifier{2, 5, 29, 17}
+ oidExtensionBasicConstraints = asn1.ObjectIdentifier{2, 5, 29, 19}
+ oidExtensionAuthorityKeyId = asn1.ObjectIdentifier{2, 5, 29, 35}
+ oidExtensionExtendedKeyUsage = asn1.ObjectIdentifier{2, 5, 29, 37}
)
type sigAlgInfo struct {
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/printcert.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/printcert.go
similarity index 100%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/printcert.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/printcert.go
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/rsapss.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/rsapss.go
similarity index 100%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/rsapss.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/rsapss.go
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/util.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/util.go
similarity index 93%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/util.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/util.go
index c26e5a5de1..3bd5d9cf90 100644
--- a/vendor/github.com/sassoftware/relic/lib/x509tools/util.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/util.go
@@ -19,6 +19,7 @@ package x509tools
import (
"crypto"
"crypto/ecdsa"
+ "crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
@@ -34,20 +35,28 @@ import (
func MakeSerial() *big.Int {
blob := make([]byte, 12)
if _, err := io.ReadFull(rand.Reader, blob); err != nil {
- return nil
+ panic(err)
}
return new(big.Int).SetBytes(blob)
}
// Choose a X509 signature algorithm suitable for the specified public key
func X509SignatureAlgorithm(pub crypto.PublicKey) x509.SignatureAlgorithm {
- switch pub.(type) {
+ switch k := pub.(type) {
case *rsa.PublicKey:
if ArgRSAPSS {
return x509.SHA256WithRSAPSS
}
return x509.SHA256WithRSA
case *ecdsa.PublicKey:
+ switch k.Curve {
+ case elliptic.P256():
+ return x509.ECDSAWithSHA256
+ case elliptic.P384():
+ return x509.ECDSAWithSHA384
+ case elliptic.P521():
+ return x509.ECDSAWithSHA512
+ }
return x509.ECDSAWithSHA256
default:
return x509.UnknownSignatureAlgorithm
diff --git a/vendor/github.com/sassoftware/relic/lib/x509tools/x509cmd.go b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/x509cmd.go
similarity index 76%
rename from vendor/github.com/sassoftware/relic/lib/x509tools/x509cmd.go
rename to vendor/github.com/sassoftware/relic/v8/lib/x509tools/x509cmd.go
index ee89eec72b..bdcb6e2df1 100644
--- a/vendor/github.com/sassoftware/relic/lib/x509tools/x509cmd.go
+++ b/vendor/github.com/sassoftware/relic/v8/lib/x509tools/x509cmd.go
@@ -19,7 +19,10 @@ package x509tools
import (
"bytes"
"crypto"
+ "crypto/ecdsa"
+ "crypto/ed25519"
"crypto/rand"
+ "crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
@@ -32,7 +35,7 @@ import (
"time"
"github.com/spf13/cobra"
- "golang.org/x/crypto/ssh/terminal"
+ "golang.org/x/term"
)
var (
@@ -80,7 +83,7 @@ func splitAndTrim(s string) []string {
if s == "" {
return nil
}
- s = strings.Replace(s, ",", " ", -1)
+ s = strings.ReplaceAll(s, ",", " ")
pieces := strings.Split(s, " ")
ret := make([]string, 0, len(pieces))
for _, p := range pieces {
@@ -222,15 +225,30 @@ func SignCSR(csrBytes []byte, rand io.Reader, key crypto.Signer, cacert *x509.Ce
}
csr, err := x509.ParseCertificateRequest(csrBytes)
if err != nil {
- return "", fmt.Errorf("parsing CSR: %s", err)
+ return "", fmt.Errorf("parsing CSR: %w", err)
}
if err := csr.CheckSignature(); err != nil {
- return "", fmt.Errorf("validating CSR: %s", err)
+ return "", fmt.Errorf("validating CSR: %w", err)
}
// update fields
template := &x509.Certificate{Subject: csr.Subject}
if copyExtensions {
- template.ExtraExtensions = csr.Extensions
+ // drop CSR extensions that are overridden or merged with our args
+ for _, ex := range csr.Extensions {
+ switch {
+ case ArgCertAuthority && ex.Id.Equal(oidExtensionBasicConstraints):
+ // arg has set CA constraint
+ case ArgKeyUsage != "" && (ex.Id.Equal(oidExtensionKeyUsage) || ex.Id.Equal(oidExtensionExtendedKeyUsage)):
+ // arg has set key usage
+ case ex.Id.Equal(oidExtensionSubjectKeyId) || ex.Id.Equal(oidExtensionAuthorityKeyId):
+ // we always set this
+ case ex.Id.Equal(oidExtensionSubjectAltName):
+ // these are copied piecemeal below
+ default:
+ // copy the extension as-is
+ template.ExtraExtensions = append(template.ExtraExtensions, ex)
+ }
+ }
template.DNSNames = csr.DNSNames
template.EmailAddresses = csr.EmailAddresses
template.IPAddresses = csr.IPAddresses
@@ -255,7 +273,7 @@ func CrossSign(certBytes []byte, rand io.Reader, key crypto.Signer, cacert *x509
}
template, err := x509.ParseCertificate(certBytes)
if err != nil {
- return "", fmt.Errorf("parsing certificate: %s", err)
+ return "", fmt.Errorf("parsing certificate: %w", err)
}
if err := fillCertFields(template, template.PublicKey, key.Public()); err != nil {
return "", err
@@ -267,50 +285,74 @@ func CrossSign(certBytes []byte, rand io.Reader, key crypto.Signer, cacert *x509
return toPemString(newCert, "CERTIFICATE"), nil
}
-type fakeSigner struct{ pub crypto.PublicKey }
-
-func (f fakeSigner) Public() crypto.PublicKey {
- return f.pub
-}
-
-func (f fakeSigner) Sign(io.Reader, []byte, crypto.SignerOpts) ([]byte, error) {
- return nil, nil
-}
-
-func confirmAndCreate(template, parent *x509.Certificate, pub crypto.PublicKey, priv crypto.PrivateKey) ([]byte, error) {
+func confirmAndCreate(template, parent *x509.Certificate, leafPub crypto.PublicKey, issuerPriv crypto.PrivateKey) ([]byte, error) {
if ArgInteractive {
- // call CreateCertificate with a fake signer to get what the final cert will look like
- pub := priv.(crypto.Signer).Public()
- der, err := x509.CreateCertificate(rand.Reader, template, parent, pub, fakeSigner{pub})
- if err != nil {
- return nil, err
+ origSigner, ok := issuerPriv.(crypto.Signer)
+ if !ok {
+ return nil, errors.New("private key must satisfy crypto.Signer")
}
- cert, err := x509.ParseCertificate(der)
+ ok, err := confirmCertificate(template, parent, leafPub, origSigner.Public())
if err != nil {
- return nil, err
- }
- fmt.Fprintln(os.Stderr, "Signing certificate:")
- fmt.Fprintln(os.Stderr)
- FprintCertificate(os.Stderr, cert)
- fmt.Fprintln(os.Stderr)
- if !promptYN("Sign this cert? [Y/n] ") {
+ return nil, fmt.Errorf("mocking cert for interactive confirmation: %w", err)
+ } else if !ok {
fmt.Fprintln(os.Stderr, "operation canceled")
os.Exit(2)
}
}
- return x509.CreateCertificate(rand.Reader, template, parent, pub, priv)
+ return x509.CreateCertificate(rand.Reader, template, parent, leafPub, issuerPriv)
+}
+
+func confirmCertificate(template, parent *x509.Certificate, leafPub, origSigner crypto.PublicKey) (bool, error) {
+ // generate a key with the same parameters as the real signer
+ fakePriv, err := generateAlike(origSigner)
+ if err != nil {
+ return false, err
+ }
+ // mangle parent cert
+ fakeParent := new(x509.Certificate)
+ *fakeParent = *parent
+ fakeParent.PublicKey = fakePriv.Public()
+ // call CreateCertificate with a fake signer to get what the final cert will look like
+ der, err := x509.CreateCertificate(rand.Reader, template, fakeParent, leafPub, fakePriv)
+ if err != nil {
+ return false, err
+ }
+ cert, err := x509.ParseCertificate(der)
+ if err != nil {
+ return false, err
+ }
+ fmt.Fprintln(os.Stderr, "Signing certificate:")
+ fmt.Fprintln(os.Stderr)
+ FprintCertificate(os.Stderr, cert)
+ fmt.Fprintln(os.Stderr)
+ return promptYN("Sign this cert? [Y/n] "), nil
+}
+
+func generateAlike(pub crypto.PublicKey) (crypto.Signer, error) {
+ // generate a dummy key of the same type as pub
+ switch pub := pub.(type) {
+ case *rsa.PublicKey:
+ return rsa.GenerateKey(rand.Reader, 1024)
+ case *ecdsa.PublicKey:
+ return ecdsa.GenerateKey(pub.Curve, rand.Reader)
+ case ed25519.PublicKey:
+ _, priv, err := ed25519.GenerateKey(rand.Reader)
+ return priv, err
+ default:
+ return nil, fmt.Errorf("unrecognized key type %T", pub)
+ }
}
func promptYN(prompt string) bool {
fmt.Fprint(os.Stderr, prompt)
- if !terminal.IsTerminal(0) {
+ if !term.IsTerminal(0) {
fmt.Fprintln(os.Stderr, "input is not a terminal, assuming true")
return true
}
- state, err := terminal.MakeRaw(0)
+ state, err := term.MakeRaw(0)
if err == nil {
defer fmt.Fprintln(os.Stderr)
- defer terminal.Restore(0, state)
+ defer func() { _ = term.Restore(0, state) }()
}
var d [1]byte
if _, err := os.Stdin.Read(d[:]); err != nil {
diff --git a/vendor/github.com/sassoftware/relic/v8/signers/sigerrors/errors.go b/vendor/github.com/sassoftware/relic/v8/signers/sigerrors/errors.go
new file mode 100644
index 0000000000..28e1af37d3
--- /dev/null
+++ b/vendor/github.com/sassoftware/relic/v8/signers/sigerrors/errors.go
@@ -0,0 +1,53 @@
+//
+// Copyright (c) SAS Institute Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package sigerrors
+
+import (
+ "errors"
+)
+
+var (
+ ErrExist = errors.New("object already exists in token")
+)
+
+type KeyNotFoundError struct{}
+
+func (KeyNotFoundError) Error() string {
+ return "No object found in token with the specified label"
+}
+
+type PinIncorrectError struct{}
+
+func (PinIncorrectError) Error() string {
+ return "The entered PIN was incorrect"
+}
+
+type ErrNoCertificate struct {
+ Type string
+}
+
+func (e ErrNoCertificate) Error() string {
+ return "no certificate of type \"" + e.Type + "\" defined for this key"
+}
+
+type NotSignedError struct {
+ Type string
+}
+
+func (e NotSignedError) Error() string {
+ return e.Type + " contains no signatures"
+}
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_parameters.go
index 5a7418e535..acb0df52ee 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_parameters.go
@@ -27,7 +27,6 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -38,24 +37,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewCreateLogEntryParams() *CreateLogEntryParams {
- return &CreateLogEntryParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewCreateLogEntryParamsWithTimeout(cr.DefaultTimeout)
}
// NewCreateLogEntryParamsWithTimeout creates a new CreateLogEntryParams object
// with the ability to set a timeout on a request.
func NewCreateLogEntryParamsWithTimeout(timeout time.Duration) *CreateLogEntryParams {
return &CreateLogEntryParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewCreateLogEntryParamsWithContext creates a new CreateLogEntryParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [CreateLogEntryParams].
func NewCreateLogEntryParamsWithContext(ctx context.Context) *CreateLogEntryParams {
return &CreateLogEntryParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -79,9 +82,9 @@ type CreateLogEntryParams struct {
// ProposedEntry.
ProposedEntry models.ProposedEntry
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the create log entry params (not the query body).
@@ -99,54 +102,57 @@ func (o *CreateLogEntryParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the create log entry params
+// WithTimeout adds the timeout to the create log entry params.
func (o *CreateLogEntryParams) WithTimeout(timeout time.Duration) *CreateLogEntryParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the create log entry params
+// SetTimeout adds the timeout to the create log entry params.
func (o *CreateLogEntryParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the create log entry params
+// WithContext adds the context to the create log entry params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [CreateLogEntryParams].
func (o *CreateLogEntryParams) WithContext(ctx context.Context) *CreateLogEntryParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the create log entry params
+// SetContext adds the context to the create log entry params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [CreateLogEntryParams].
func (o *CreateLogEntryParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the create log entry params
+// WithHTTPClient adds the HTTPClient to the create log entry params.
func (o *CreateLogEntryParams) WithHTTPClient(client *http.Client) *CreateLogEntryParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the create log entry params
+// SetHTTPClient adds the HTTPClient to the create log entry params.
func (o *CreateLogEntryParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithProposedEntry adds the proposedEntry to the create log entry params
+// WithProposedEntry adds the proposedEntry to the create log entry params.
func (o *CreateLogEntryParams) WithProposedEntry(proposedEntry models.ProposedEntry) *CreateLogEntryParams {
o.SetProposedEntry(proposedEntry)
return o
}
-// SetProposedEntry adds the proposedEntry to the create log entry params
+// SetProposedEntry adds the proposedEntry to the create log entry params.
func (o *CreateLogEntryParams) SetProposedEntry(proposedEntry models.ProposedEntry) {
o.ProposedEntry = proposedEntry
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *CreateLogEntryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_responses.go
index 198047ed0c..43983e2c58 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_responses.go
@@ -27,7 +27,6 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -74,21 +73,17 @@ func NewCreateLogEntryCreated() *CreateLogEntryCreated {
return &CreateLogEntryCreated{}
}
-/*
-CreateLogEntryCreated describes a response with status code 201, with default header values.
-
-Returns the entry created in the transparency log
-*/
+// CreateLogEntryCreated describes a response with status code 201, with default header values.
+//
+// Returns the entry created in the transparency log
type CreateLogEntryCreated struct {
- /* UUID of log entry
- */
+ // UUID of log entry
ETag string
- /* URI location of log entry
-
- Format: uri
- */
+ // URI location of log entry
+ //
+ // Format: uri
Location strfmt.URI
Payload models.LogEntry
@@ -171,11 +166,9 @@ func NewCreateLogEntryBadRequest() *CreateLogEntryBadRequest {
return &CreateLogEntryBadRequest{}
}
-/*
-CreateLogEntryBadRequest describes a response with status code 400, with default header values.
-
-The content supplied to the server was invalid
-*/
+// CreateLogEntryBadRequest describes a response with status code 400, with default header values.
+//
+// The content supplied to the server was invalid
type CreateLogEntryBadRequest struct {
Payload *models.Error
}
@@ -241,11 +234,9 @@ func NewCreateLogEntryConflict() *CreateLogEntryConflict {
return &CreateLogEntryConflict{}
}
-/*
-CreateLogEntryConflict describes a response with status code 409, with default header values.
-
-The request conflicts with the current state of the transparency log
-*/
+// CreateLogEntryConflict describes a response with status code 409, with default header values.
+//
+// The request conflicts with the current state of the transparency log
type CreateLogEntryConflict struct {
Location strfmt.URI
@@ -326,11 +317,9 @@ func NewCreateLogEntryDefault(code int) *CreateLogEntryDefault {
}
}
-/*
-CreateLogEntryDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// CreateLogEntryDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type CreateLogEntryDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/entries_client.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/entries_client.go
index 713b0ef671..3d17756cb1 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/entries_client.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/entries_client.go
@@ -19,17 +19,21 @@
package entries
import (
+ "context"
+ "time"
+
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new entries API client.
-func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
+func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new entries API client with basic auth credentials.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -43,6 +47,7 @@ func NewClientWithBasicAuth(host, basePath, scheme, user, password string) Clien
}
// New creates a new entries API client with a bearer token for authentication.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -54,40 +59,77 @@ func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) Client
return &Client{transport: transport, formats: strfmt.Default}
}
-/*
-Client for entries API
-*/
+// Client for entries API.
type Client struct {
- transport runtime.ClientTransport
+ transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)
-// ClientService is the interface for Client methods
+// ClientService is the interface for Client methods.
type ClientService interface {
+
+ // CreateLogEntry creates an entry in the transparency log.
CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error)
+ // CreateLogEntryContext creates an entry in the transparency log.
+ CreateLogEntryContext(ctx context.Context, params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error)
+
+ // GetLogEntryByIndex retrieves an entry and inclusion proof from the transparency log if it exists by index.
GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error)
+ // GetLogEntryByIndexContext retrieves an entry and inclusion proof from the transparency log if it exists by index.
+ GetLogEntryByIndexContext(ctx context.Context, params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error)
+
+ // GetLogEntryByUUID get log entry and information required to generate an inclusion proof for the entry in the transparency log.
GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error)
+ // GetLogEntryByUUIDContext get log entry and information required to generate an inclusion proof for the entry in the transparency log.
+ GetLogEntryByUUIDContext(ctx context.Context, params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error)
+
+ // SearchLogQuery searches transparency log for one or more log entries.
SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error)
- SetTransport(transport runtime.ClientTransport)
-}
+ // SearchLogQueryContext searches transparency log for one or more log entries.
+ SearchLogQueryContext(ctx context.Context, params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error)
-/*
-CreateLogEntry creates an entry in the transparency log
+ SetTransport(transport runtime.ContextualTransport)
+}
-Creates an entry in the transparency log for a detached signature, public key, and content.
-*/
+// CreateLogEntry creates an entry in the transparency log.
+//
+// Creates an entry in the transparency log for a detached signature, public key, and content.
+// .
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.CreateLogEntryContext] instead.
func (a *Client) CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.CreateLogEntryContext(ctx, params, opts...)
+}
+
+// CreateLogEntryContext creates an entry in the transparency log.
+//
+// Creates an entry in the transparency log for a detached signature, public key, and content.
+// .
+//
+// Do not use the deprecated [CreateLogEntryParams.Context] with this method: it would be ignored.
+func (a *Client) CreateLogEntryContext(ctx context.Context, params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewCreateLogEntryParams()
}
+
op := &runtime.ClientOperation{
ID: "createLogEntry",
Method: "POST",
@@ -97,13 +139,14 @@ func (a *Client) CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOpti
Schemes: []string{"http"},
Params: params,
Reader: &CreateLogEntryReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -122,14 +165,32 @@ func (a *Client) CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOpti
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
-/*
-GetLogEntryByIndex retrieves an entry and inclusion proof from the transparency log if it exists by index
-*/
+// GetLogEntryByIndex retrieves an entry and inclusion proof from the transparency log if it exists by index.
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.GetLogEntryByIndexContext] instead.
func (a *Client) GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.GetLogEntryByIndexContext(ctx, params, opts...)
+}
+
+// GetLogEntryByIndexContext retrieves an entry and inclusion proof from the transparency log if it exists by index.
+//
+// Do not use the deprecated [GetLogEntryByIndexParams.Context] with this method: it would be ignored.
+func (a *Client) GetLogEntryByIndexContext(ctx context.Context, params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewGetLogEntryByIndexParams()
}
+
op := &runtime.ClientOperation{
ID: "getLogEntryByIndex",
Method: "GET",
@@ -139,13 +200,14 @@ func (a *Client) GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...Cl
Schemes: []string{"http"},
Params: params,
Reader: &GetLogEntryByIndexReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -164,16 +226,36 @@ func (a *Client) GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...Cl
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
-/*
-GetLogEntryByUUID gets log entry and information required to generate an inclusion proof for the entry in the transparency log
-
-Returns the entry, root hash, tree size, and a list of hashes that can be used to calculate proof of an entry being included in the transparency log
-*/
+// GetLogEntryByUUID gets log entry and information required to generate an inclusion proof for the entry in the transparency log.
+//
+// Returns the entry, root hash, tree size, and a list of hashes that can be used to calculate proof of an entry being included in the transparency log.
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.GetLogEntryByUUIDContext] instead.
func (a *Client) GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.GetLogEntryByUUIDContext(ctx, params, opts...)
+}
+
+// GetLogEntryByUUIDContext gets log entry and information required to generate an inclusion proof for the entry in the transparency log.
+//
+// Returns the entry, root hash, tree size, and a list of hashes that can be used to calculate proof of an entry being included in the transparency log.
+//
+// Do not use the deprecated [GetLogEntryByUUIDParams.Context] with this method: it would be ignored.
+func (a *Client) GetLogEntryByUUIDContext(ctx context.Context, params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewGetLogEntryByUUIDParams()
}
+
op := &runtime.ClientOperation{
ID: "getLogEntryByUUID",
Method: "GET",
@@ -183,13 +265,14 @@ func (a *Client) GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...Clie
Schemes: []string{"http"},
Params: params,
Reader: &GetLogEntryByUUIDReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -208,14 +291,32 @@ func (a *Client) GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...Clie
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
-/*
-SearchLogQuery searches transparency log for one or more log entries
-*/
+// SearchLogQuery searches transparency log for one or more log entries.
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.SearchLogQueryContext] instead.
func (a *Client) SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.SearchLogQueryContext(ctx, params, opts...)
+}
+
+// SearchLogQueryContext searches transparency log for one or more log entries.
+//
+// Do not use the deprecated [SearchLogQueryParams.Context] with this method: it would be ignored.
+func (a *Client) SearchLogQueryContext(ctx context.Context, params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewSearchLogQueryParams()
}
+
op := &runtime.ClientOperation{
ID: "searchLogQuery",
Method: "POST",
@@ -225,13 +326,14 @@ func (a *Client) SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOpti
Schemes: []string{"http"},
Params: params,
Reader: &SearchLogQueryReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -251,6 +353,14 @@ func (a *Client) SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOpti
}
// SetTransport changes the transport on the client
-func (a *Client) SetTransport(transport runtime.ClientTransport) {
+func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
+
+// innerParams captures internal fields so they don't conflict with user-supplied parameters.
+type innerParams struct {
+ timeout time.Duration
+
+ // Deprecated: use the operation call with context to pass the context instead of [EntriesParams].
+ ctx context.Context
+}
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_parameters.go
index 8ec6c28042..2d4b319f5b 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_parameters.go
@@ -27,7 +27,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/conv"
)
// NewGetLogEntryByIndexParams creates a new GetLogEntryByIndexParams object,
@@ -37,24 +37,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetLogEntryByIndexParams() *GetLogEntryByIndexParams {
- return &GetLogEntryByIndexParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewGetLogEntryByIndexParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetLogEntryByIndexParamsWithTimeout creates a new GetLogEntryByIndexParams object
// with the ability to set a timeout on a request.
func NewGetLogEntryByIndexParamsWithTimeout(timeout time.Duration) *GetLogEntryByIndexParams {
return &GetLogEntryByIndexParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewGetLogEntryByIndexParamsWithContext creates a new GetLogEntryByIndexParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogEntryByIndexParams].
func NewGetLogEntryByIndexParamsWithContext(ctx context.Context) *GetLogEntryByIndexParams {
return &GetLogEntryByIndexParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -75,15 +79,14 @@ GetLogEntryByIndexParams contains all the parameters to send to the API endpoint
*/
type GetLogEntryByIndexParams struct {
- /* LogIndex.
-
- specifies the index of the entry in the transparency log to be retrieved
- */
+ // LogIndex.
+ //
+ // specifies the index of the entry in the transparency log to be retrieved
LogIndex int64
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the get log entry by index params (not the query body).
@@ -101,61 +104,64 @@ func (o *GetLogEntryByIndexParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the get log entry by index params
+// WithTimeout adds the timeout to the get log entry by index params.
func (o *GetLogEntryByIndexParams) WithTimeout(timeout time.Duration) *GetLogEntryByIndexParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the get log entry by index params
+// SetTimeout adds the timeout to the get log entry by index params.
func (o *GetLogEntryByIndexParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the get log entry by index params
+// WithContext adds the context to the get log entry by index params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogEntryByIndexParams].
func (o *GetLogEntryByIndexParams) WithContext(ctx context.Context) *GetLogEntryByIndexParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the get log entry by index params
+// SetContext adds the context to the get log entry by index params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogEntryByIndexParams].
func (o *GetLogEntryByIndexParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the get log entry by index params
+// WithHTTPClient adds the HTTPClient to the get log entry by index params.
func (o *GetLogEntryByIndexParams) WithHTTPClient(client *http.Client) *GetLogEntryByIndexParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the get log entry by index params
+// SetHTTPClient adds the HTTPClient to the get log entry by index params.
func (o *GetLogEntryByIndexParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithLogIndex adds the logIndex to the get log entry by index params
+// WithLogIndex adds the logIndex to the get log entry by index params.
func (o *GetLogEntryByIndexParams) WithLogIndex(logIndex int64) *GetLogEntryByIndexParams {
o.SetLogIndex(logIndex)
return o
}
-// SetLogIndex adds the logIndex to the get log entry by index params
+// SetLogIndex adds the logIndex to the get log entry by index params.
func (o *GetLogEntryByIndexParams) SetLogIndex(logIndex int64) {
o.LogIndex = logIndex
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetLogEntryByIndexParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
// query param logIndex
qrLogIndex := o.LogIndex
- qLogIndex := swag.FormatInt64(qrLogIndex)
+ qLogIndex := conv.FormatInteger(qrLogIndex)
if qLogIndex != "" {
if err := r.SetQueryParam("logIndex", qLogIndex); err != nil {
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_responses.go
index 6be99b7e40..7f0c3f402a 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -67,11 +66,9 @@ func NewGetLogEntryByIndexOK() *GetLogEntryByIndexOK {
return &GetLogEntryByIndexOK{}
}
-/*
-GetLogEntryByIndexOK describes a response with status code 200, with default header values.
-
-the entry in the transparency log requested along with an inclusion proof
-*/
+// GetLogEntryByIndexOK describes a response with status code 200, with default header values.
+//
+// the entry in the transparency log requested along with an inclusion proof
type GetLogEntryByIndexOK struct {
Payload models.LogEntry
}
@@ -135,11 +132,9 @@ func NewGetLogEntryByIndexNotFound() *GetLogEntryByIndexNotFound {
return &GetLogEntryByIndexNotFound{}
}
-/*
-GetLogEntryByIndexNotFound describes a response with status code 404, with default header values.
-
-The content requested could not be found
-*/
+// GetLogEntryByIndexNotFound describes a response with status code 404, with default header values.
+//
+// The content requested could not be found
type GetLogEntryByIndexNotFound struct {
}
@@ -193,11 +188,9 @@ func NewGetLogEntryByIndexDefault(code int) *GetLogEntryByIndexDefault {
}
}
-/*
-GetLogEntryByIndexDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// GetLogEntryByIndexDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type GetLogEntryByIndexDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_parameters.go
index ddd769ad9d..970f851ff2 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_parameters.go
@@ -36,24 +36,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetLogEntryByUUIDParams() *GetLogEntryByUUIDParams {
- return &GetLogEntryByUUIDParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewGetLogEntryByUUIDParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetLogEntryByUUIDParamsWithTimeout creates a new GetLogEntryByUUIDParams object
// with the ability to set a timeout on a request.
func NewGetLogEntryByUUIDParamsWithTimeout(timeout time.Duration) *GetLogEntryByUUIDParams {
return &GetLogEntryByUUIDParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewGetLogEntryByUUIDParamsWithContext creates a new GetLogEntryByUUIDParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogEntryByUUIDParams].
func NewGetLogEntryByUUIDParamsWithContext(ctx context.Context) *GetLogEntryByUUIDParams {
return &GetLogEntryByUUIDParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -74,15 +78,14 @@ GetLogEntryByUUIDParams contains all the parameters to send to the API endpoint
*/
type GetLogEntryByUUIDParams struct {
- /* EntryUUID.
-
- the UUID of the entry for which the inclusion proof information should be returned
- */
+ // EntryUUID.
+ //
+ // the UUID of the entry for which the inclusion proof information should be returned
EntryUUID string
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the get log entry by UUID params (not the query body).
@@ -100,54 +103,57 @@ func (o *GetLogEntryByUUIDParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the get log entry by UUID params
+// WithTimeout adds the timeout to the get log entry by UUID params.
func (o *GetLogEntryByUUIDParams) WithTimeout(timeout time.Duration) *GetLogEntryByUUIDParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the get log entry by UUID params
+// SetTimeout adds the timeout to the get log entry by UUID params.
func (o *GetLogEntryByUUIDParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the get log entry by UUID params
+// WithContext adds the context to the get log entry by UUID params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogEntryByUUIDParams].
func (o *GetLogEntryByUUIDParams) WithContext(ctx context.Context) *GetLogEntryByUUIDParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the get log entry by UUID params
+// SetContext adds the context to the get log entry by UUID params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogEntryByUUIDParams].
func (o *GetLogEntryByUUIDParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the get log entry by UUID params
+// WithHTTPClient adds the HTTPClient to the get log entry by UUID params.
func (o *GetLogEntryByUUIDParams) WithHTTPClient(client *http.Client) *GetLogEntryByUUIDParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the get log entry by UUID params
+// SetHTTPClient adds the HTTPClient to the get log entry by UUID params.
func (o *GetLogEntryByUUIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithEntryUUID adds the entryUUID to the get log entry by UUID params
+// WithEntryUUID adds the entryUUID to the get log entry by UUID params.
func (o *GetLogEntryByUUIDParams) WithEntryUUID(entryUUID string) *GetLogEntryByUUIDParams {
o.SetEntryUUID(entryUUID)
return o
}
-// SetEntryUUID adds the entryUuid to the get log entry by UUID params
+// SetEntryUUID adds the entryUuid to the get log entry by UUID params.
func (o *GetLogEntryByUUIDParams) SetEntryUUID(entryUUID string) {
o.EntryUUID = entryUUID
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetLogEntryByUUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_responses.go
index 9ea6b57f14..f67c3ce127 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -67,11 +66,9 @@ func NewGetLogEntryByUUIDOK() *GetLogEntryByUUIDOK {
return &GetLogEntryByUUIDOK{}
}
-/*
-GetLogEntryByUUIDOK describes a response with status code 200, with default header values.
-
-Information needed for a client to compute the inclusion proof
-*/
+// GetLogEntryByUUIDOK describes a response with status code 200, with default header values.
+//
+// Information needed for a client to compute the inclusion proof
type GetLogEntryByUUIDOK struct {
Payload models.LogEntry
}
@@ -135,11 +132,9 @@ func NewGetLogEntryByUUIDNotFound() *GetLogEntryByUUIDNotFound {
return &GetLogEntryByUUIDNotFound{}
}
-/*
-GetLogEntryByUUIDNotFound describes a response with status code 404, with default header values.
-
-The content requested could not be found
-*/
+// GetLogEntryByUUIDNotFound describes a response with status code 404, with default header values.
+//
+// The content requested could not be found
type GetLogEntryByUUIDNotFound struct {
}
@@ -193,11 +188,9 @@ func NewGetLogEntryByUUIDDefault(code int) *GetLogEntryByUUIDDefault {
}
}
-/*
-GetLogEntryByUUIDDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// GetLogEntryByUUIDDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type GetLogEntryByUUIDDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_parameters.go
index ce248ff9a7..92ac0859e1 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_parameters.go
@@ -27,7 +27,6 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -38,24 +37,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewSearchLogQueryParams() *SearchLogQueryParams {
- return &SearchLogQueryParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewSearchLogQueryParamsWithTimeout(cr.DefaultTimeout)
}
// NewSearchLogQueryParamsWithTimeout creates a new SearchLogQueryParams object
// with the ability to set a timeout on a request.
func NewSearchLogQueryParamsWithTimeout(timeout time.Duration) *SearchLogQueryParams {
return &SearchLogQueryParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewSearchLogQueryParamsWithContext creates a new SearchLogQueryParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [SearchLogQueryParams].
func NewSearchLogQueryParamsWithContext(ctx context.Context) *SearchLogQueryParams {
return &SearchLogQueryParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -79,9 +82,9 @@ type SearchLogQueryParams struct {
// Entry.
Entry *models.SearchLogQuery
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the search log query params (not the query body).
@@ -99,54 +102,57 @@ func (o *SearchLogQueryParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the search log query params
+// WithTimeout adds the timeout to the search log query params.
func (o *SearchLogQueryParams) WithTimeout(timeout time.Duration) *SearchLogQueryParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the search log query params
+// SetTimeout adds the timeout to the search log query params.
func (o *SearchLogQueryParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the search log query params
+// WithContext adds the context to the search log query params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [SearchLogQueryParams].
func (o *SearchLogQueryParams) WithContext(ctx context.Context) *SearchLogQueryParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the search log query params
+// SetContext adds the context to the search log query params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [SearchLogQueryParams].
func (o *SearchLogQueryParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the search log query params
+// WithHTTPClient adds the HTTPClient to the search log query params.
func (o *SearchLogQueryParams) WithHTTPClient(client *http.Client) *SearchLogQueryParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the search log query params
+// SetHTTPClient adds the HTTPClient to the search log query params.
func (o *SearchLogQueryParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithEntry adds the entry to the search log query params
+// WithEntry adds the entry to the search log query params.
func (o *SearchLogQueryParams) WithEntry(entry *models.SearchLogQuery) *SearchLogQueryParams {
o.SetEntry(entry)
return o
}
-// SetEntry adds the entry to the search log query params
+// SetEntry adds the entry to the search log query params.
func (o *SearchLogQueryParams) SetEntry(entry *models.SearchLogQuery) {
o.Entry = entry
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *SearchLogQueryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_responses.go
index 7891f4b915..c7e76fe799 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -73,11 +72,9 @@ func NewSearchLogQueryOK() *SearchLogQueryOK {
return &SearchLogQueryOK{}
}
-/*
-SearchLogQueryOK describes a response with status code 200, with default header values.
-
-Returns zero or more entries from the transparency log, according to how many were included in request query
-*/
+// SearchLogQueryOK describes a response with status code 200, with default header values.
+//
+// Returns zero or more entries from the transparency log, according to how many were included in request query
type SearchLogQueryOK struct {
Payload []models.LogEntry
}
@@ -141,11 +138,9 @@ func NewSearchLogQueryBadRequest() *SearchLogQueryBadRequest {
return &SearchLogQueryBadRequest{}
}
-/*
-SearchLogQueryBadRequest describes a response with status code 400, with default header values.
-
-The content supplied to the server was invalid
-*/
+// SearchLogQueryBadRequest describes a response with status code 400, with default header values.
+//
+// The content supplied to the server was invalid
type SearchLogQueryBadRequest struct {
Payload *models.Error
}
@@ -211,11 +206,9 @@ func NewSearchLogQueryUnprocessableEntity() *SearchLogQueryUnprocessableEntity {
return &SearchLogQueryUnprocessableEntity{}
}
-/*
-SearchLogQueryUnprocessableEntity describes a response with status code 422, with default header values.
-
-The server understood the request but is unable to process the contained instructions
-*/
+// SearchLogQueryUnprocessableEntity describes a response with status code 422, with default header values.
+//
+// The server understood the request but is unable to process the contained instructions
type SearchLogQueryUnprocessableEntity struct {
Payload *models.Error
}
@@ -283,11 +276,9 @@ func NewSearchLogQueryDefault(code int) *SearchLogQueryDefault {
}
}
-/*
-SearchLogQueryDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// SearchLogQueryDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type SearchLogQueryDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/index/index_client.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/index/index_client.go
index 8acf59d4df..1b9bae1e00 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/index/index_client.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/index/index_client.go
@@ -19,17 +19,21 @@
package index
import (
+ "context"
+ "time"
+
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new index API client.
-func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
+func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new index API client with basic auth credentials.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -43,6 +47,7 @@ func NewClientWithBasicAuth(host, basePath, scheme, user, password string) Clien
}
// New creates a new index API client with a bearer token for authentication.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -54,36 +59,61 @@ func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) Client
return &Client{transport: transport, formats: strfmt.Default}
}
-/*
-Client for index API
-*/
+// Client for index API.
type Client struct {
- transport runtime.ClientTransport
+ transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)
-// ClientService is the interface for Client methods
+// ClientService is the interface for Client methods.
type ClientService interface {
+
+ // SearchIndex searches index by entry metadata.
SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error)
- SetTransport(transport runtime.ClientTransport)
+ // SearchIndexContext searches index by entry metadata.
+ SearchIndexContext(ctx context.Context, params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error)
+
+ SetTransport(transport runtime.ContextualTransport)
}
-/*
- SearchIndex searches index by entry metadata
+// SearchIndex searches index by entry metadata.
+//
+// EXPERIMENTAL - this endpoint is offered as best effort only and may be changed or removed in future releases.
+// The results returned from this endpoint may be incomplete.
+// .
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.SearchIndexContext] instead.
+func (a *Client) SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
- EXPERIMENTAL - this endpoint is offered as best effort only and may be changed or removed in future releases.
+ return a.SearchIndexContext(ctx, params, opts...)
+}
-The results returned from this endpoint may be incomplete.
-*/
-func (a *Client) SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error) {
+// SearchIndexContext searches index by entry metadata.
+//
+// EXPERIMENTAL - this endpoint is offered as best effort only and may be changed or removed in future releases.
+// The results returned from this endpoint may be incomplete.
+// .
+//
+// Do not use the deprecated [SearchIndexParams.Context] with this method: it would be ignored.
+func (a *Client) SearchIndexContext(ctx context.Context, params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewSearchIndexParams()
}
+
op := &runtime.ClientOperation{
ID: "searchIndex",
Method: "POST",
@@ -93,13 +123,14 @@ func (a *Client) SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*
Schemes: []string{"http"},
Params: params,
Reader: &SearchIndexReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -119,6 +150,14 @@ func (a *Client) SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*
}
// SetTransport changes the transport on the client
-func (a *Client) SetTransport(transport runtime.ClientTransport) {
+func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
+
+// innerParams captures internal fields so they don't conflict with user-supplied parameters.
+type innerParams struct {
+ timeout time.Duration
+
+ // Deprecated: use the operation call with context to pass the context instead of [IndexParams].
+ ctx context.Context
+}
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_parameters.go
index 90f2e0f325..bb2b977b81 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_parameters.go
@@ -27,7 +27,6 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -38,24 +37,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewSearchIndexParams() *SearchIndexParams {
- return &SearchIndexParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewSearchIndexParamsWithTimeout(cr.DefaultTimeout)
}
// NewSearchIndexParamsWithTimeout creates a new SearchIndexParams object
// with the ability to set a timeout on a request.
func NewSearchIndexParamsWithTimeout(timeout time.Duration) *SearchIndexParams {
return &SearchIndexParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewSearchIndexParamsWithContext creates a new SearchIndexParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [SearchIndexParams].
func NewSearchIndexParamsWithContext(ctx context.Context) *SearchIndexParams {
return &SearchIndexParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -79,9 +82,9 @@ type SearchIndexParams struct {
// Query.
Query *models.SearchIndex
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the search index params (not the query body).
@@ -99,54 +102,57 @@ func (o *SearchIndexParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the search index params
+// WithTimeout adds the timeout to the search index params.
func (o *SearchIndexParams) WithTimeout(timeout time.Duration) *SearchIndexParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the search index params
+// SetTimeout adds the timeout to the search index params.
func (o *SearchIndexParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the search index params
+// WithContext adds the context to the search index params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [SearchIndexParams].
func (o *SearchIndexParams) WithContext(ctx context.Context) *SearchIndexParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the search index params
+// SetContext adds the context to the search index params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [SearchIndexParams].
func (o *SearchIndexParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the search index params
+// WithHTTPClient adds the HTTPClient to the search index params.
func (o *SearchIndexParams) WithHTTPClient(client *http.Client) *SearchIndexParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the search index params
+// SetHTTPClient adds the HTTPClient to the search index params.
func (o *SearchIndexParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithQuery adds the query to the search index params
+// WithQuery adds the query to the search index params.
func (o *SearchIndexParams) WithQuery(query *models.SearchIndex) *SearchIndexParams {
o.SetQuery(query)
return o
}
-// SetQuery adds the query to the search index params
+// SetQuery adds the query to the search index params.
func (o *SearchIndexParams) SetQuery(query *models.SearchIndex) {
o.Query = query
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *SearchIndexParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_responses.go
index 951a1254d3..ced7e61c97 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -67,11 +66,9 @@ func NewSearchIndexOK() *SearchIndexOK {
return &SearchIndexOK{}
}
-/*
-SearchIndexOK describes a response with status code 200, with default header values.
-
-Returns zero or more entry UUIDs from the transparency log based on search query
-*/
+// SearchIndexOK describes a response with status code 200, with default header values.
+//
+// Returns zero or more entry UUIDs from the transparency log based on search query
type SearchIndexOK struct {
Payload []string
}
@@ -135,11 +132,9 @@ func NewSearchIndexBadRequest() *SearchIndexBadRequest {
return &SearchIndexBadRequest{}
}
-/*
-SearchIndexBadRequest describes a response with status code 400, with default header values.
-
-The content supplied to the server was invalid
-*/
+// SearchIndexBadRequest describes a response with status code 400, with default header values.
+//
+// The content supplied to the server was invalid
type SearchIndexBadRequest struct {
Payload *models.Error
}
@@ -207,11 +202,9 @@ func NewSearchIndexDefault(code int) *SearchIndexDefault {
}
}
-/*
-SearchIndexDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// SearchIndexDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type SearchIndexDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_parameters.go
index b649e08976..a8722508f2 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_parameters.go
@@ -36,24 +36,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetPublicKeyParams() *GetPublicKeyParams {
- return &GetPublicKeyParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewGetPublicKeyParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetPublicKeyParamsWithTimeout creates a new GetPublicKeyParams object
// with the ability to set a timeout on a request.
func NewGetPublicKeyParamsWithTimeout(timeout time.Duration) *GetPublicKeyParams {
return &GetPublicKeyParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewGetPublicKeyParamsWithContext creates a new GetPublicKeyParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetPublicKeyParams].
func NewGetPublicKeyParamsWithContext(ctx context.Context) *GetPublicKeyParams {
return &GetPublicKeyParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -74,15 +78,14 @@ GetPublicKeyParams contains all the parameters to send to the API endpoint
*/
type GetPublicKeyParams struct {
- /* TreeID.
-
- The tree ID of the tree you wish to get a public key for
- */
+ // TreeID.
+ //
+ // The tree ID of the tree you wish to get a public key for
TreeID *string
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the get public key params (not the query body).
@@ -100,54 +103,57 @@ func (o *GetPublicKeyParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the get public key params
+// WithTimeout adds the timeout to the get public key params.
func (o *GetPublicKeyParams) WithTimeout(timeout time.Duration) *GetPublicKeyParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the get public key params
+// SetTimeout adds the timeout to the get public key params.
func (o *GetPublicKeyParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the get public key params
+// WithContext adds the context to the get public key params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetPublicKeyParams].
func (o *GetPublicKeyParams) WithContext(ctx context.Context) *GetPublicKeyParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the get public key params
+// SetContext adds the context to the get public key params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetPublicKeyParams].
func (o *GetPublicKeyParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the get public key params
+// WithHTTPClient adds the HTTPClient to the get public key params.
func (o *GetPublicKeyParams) WithHTTPClient(client *http.Client) *GetPublicKeyParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the get public key params
+// SetHTTPClient adds the HTTPClient to the get public key params.
func (o *GetPublicKeyParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithTreeID adds the treeID to the get public key params
+// WithTreeID adds the treeID to the get public key params.
func (o *GetPublicKeyParams) WithTreeID(treeID *string) *GetPublicKeyParams {
o.SetTreeID(treeID)
return o
}
-// SetTreeID adds the treeId to the get public key params
+// SetTreeID adds the treeId to the get public key params.
func (o *GetPublicKeyParams) SetTreeID(treeID *string) {
o.TreeID = treeID
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetPublicKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_responses.go
index 923ee3cf6e..6384568789 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -61,11 +60,9 @@ func NewGetPublicKeyOK() *GetPublicKeyOK {
return &GetPublicKeyOK{}
}
-/*
-GetPublicKeyOK describes a response with status code 200, with default header values.
-
-The public key
-*/
+// GetPublicKeyOK describes a response with status code 200, with default header values.
+//
+// The public key
type GetPublicKeyOK struct {
Payload string
}
@@ -131,11 +128,9 @@ func NewGetPublicKeyDefault(code int) *GetPublicKeyDefault {
}
}
-/*
-GetPublicKeyDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// GetPublicKeyDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type GetPublicKeyDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/pubkey_client.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/pubkey_client.go
index d2ed8be91f..a2d77007ab 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/pubkey_client.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/pubkey_client.go
@@ -19,17 +19,21 @@
package pubkey
import (
+ "context"
+ "time"
+
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new pubkey API client.
-func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
+func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new pubkey API client with basic auth credentials.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -43,6 +47,7 @@ func NewClientWithBasicAuth(host, basePath, scheme, user, password string) Clien
}
// New creates a new pubkey API client with a bearer token for authentication.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -54,11 +59,9 @@ func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) Client
return &Client{transport: transport, formats: strfmt.Default}
}
-/*
-Client for pubkey API
-*/
+// Client for pubkey API.
type Client struct {
- transport runtime.ClientTransport
+ transport runtime.ContextualTransport
formats strfmt.Registry
}
@@ -89,23 +92,48 @@ func WithAcceptApplicationxPemFile(r *runtime.ClientOperation) {
r.ProducesMediaTypes = []string{"application/x-pem-file"}
}
-// ClientService is the interface for Client methods
+// ClientService is the interface for Client methods.
type ClientService interface {
+
+ // GetPublicKey retrieve the public key that can be used to validate the signed tree head.
GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error)
- SetTransport(transport runtime.ClientTransport)
-}
+ // GetPublicKeyContext retrieve the public key that can be used to validate the signed tree head.
+ GetPublicKeyContext(ctx context.Context, params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error)
-/*
-GetPublicKey retrieves the public key that can be used to validate the signed tree head
+ SetTransport(transport runtime.ContextualTransport)
+}
-Returns the public key that can be used to validate the signed tree head
-*/
+// GetPublicKey retrieves the public key that can be used to validate the signed tree head.
+//
+// Returns the public key that can be used to validate the signed tree head.
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.GetPublicKeyContext] instead.
func (a *Client) GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.GetPublicKeyContext(ctx, params, opts...)
+}
+
+// GetPublicKeyContext retrieves the public key that can be used to validate the signed tree head.
+//
+// Returns the public key that can be used to validate the signed tree head.
+//
+// Do not use the deprecated [GetPublicKeyParams.Context] with this method: it would be ignored.
+func (a *Client) GetPublicKeyContext(ctx context.Context, params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewGetPublicKeyParams()
}
+
op := &runtime.ClientOperation{
ID: "getPublicKey",
Method: "GET",
@@ -115,13 +143,14 @@ func (a *Client) GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption)
Schemes: []string{"http"},
Params: params,
Reader: &GetPublicKeyReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -141,6 +170,14 @@ func (a *Client) GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption)
}
// SetTransport changes the transport on the client
-func (a *Client) SetTransport(transport runtime.ClientTransport) {
+func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
+
+// innerParams captures internal fields so they don't conflict with user-supplied parameters.
+type innerParams struct {
+ timeout time.Duration
+
+ // Deprecated: use the operation call with context to pass the context instead of [PubkeyParams].
+ ctx context.Context
+}
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/rekor_client.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/rekor_client.go
index 131c7e1639..0459329a3e 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/rekor_client.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/rekor_client.go
@@ -19,10 +19,11 @@
package client
import (
+ "maps"
+
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/client/entries"
"github.com/sigstore/rekor/pkg/generated/client/index"
"github.com/sigstore/rekor/pkg/generated/client/pubkey"
@@ -33,15 +34,13 @@ import (
var Default = NewHTTPClient(nil)
const (
- // DefaultHost is the default Host
- // found in Meta (info) section of spec file
+ // DefaultHost is the default Host found in Meta (info) section of spec file.
DefaultHost string = "rekor.sigstore.dev"
- // DefaultBasePath is the default BasePath
- // found in Meta (info) section of spec file
+ // DefaultBasePath is the default BasePath found in Meta (info) section of spec file.
DefaultBasePath string = "/"
)
-// DefaultSchemes are the default schemes found in Meta (info) section of spec file
+// DefaultSchemes are the default schemes found in Meta (info) section of spec file.
var DefaultSchemes = []string{"http"}
// NewHTTPClient creates a new rekor HTTP client.
@@ -57,13 +56,16 @@ func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Rek
cfg = DefaultTransportConfig()
}
- // create transport and client
+ // create transport and client.
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
+ maps.Copy(transport.Producers, cfg.Producers)
+ maps.Copy(transport.Consumers, cfg.Consumers)
+
return New(transport, formats)
}
-// New creates a new rekor client
-func New(transport runtime.ClientTransport, formats strfmt.Registry) *Rekor {
+// New creates a new rekor client.
+func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Rekor {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
@@ -75,6 +77,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Rekor {
cli.Index = index.New(transport, formats)
cli.Pubkey = pubkey.New(transport, formats)
cli.Tlog = tlog.New(transport, formats)
+
return cli
}
@@ -91,9 +94,11 @@ func DefaultTransportConfig() *TransportConfig {
// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
- Host string
- BasePath string
- Schemes []string
+ Host string
+ BasePath string
+ Schemes []string
+ Producers map[string]runtime.Producer
+ Consumers map[string]runtime.Consumer
}
// WithHost overrides the default host,
@@ -117,7 +122,19 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
return cfg
}
-// Rekor is a client for rekor
+// WithProducers overrides the default producers registered by [httptransport.Runtime].
+func (cfg *TransportConfig) WithProducers(producers map[string]runtime.Producer) *TransportConfig {
+ cfg.Producers = producers
+ return cfg
+}
+
+// WithConsumers overrides the default consumers registered by [httptransport.Runtime].
+func (cfg *TransportConfig) WithConsumers(consumers map[string]runtime.Consumer) *TransportConfig {
+ cfg.Consumers = consumers
+ return cfg
+}
+
+// Rekor is a client for rekor.
type Rekor struct {
Entries entries.ClientService
@@ -127,11 +144,11 @@ type Rekor struct {
Tlog tlog.ClientService
- Transport runtime.ClientTransport
+ Transport runtime.ContextualTransport
}
-// SetTransport changes the transport on the client and all its subresources
-func (c *Rekor) SetTransport(transport runtime.ClientTransport) {
+// SetTransport changes the transport on the client and all its subresources.
+func (c *Rekor) SetTransport(transport runtime.ContextualTransport) {
c.Transport = transport
c.Entries.SetTransport(transport)
c.Index.SetTransport(transport)
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_parameters.go
index 764c2e9d4c..9ef06c1383 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_parameters.go
@@ -36,24 +36,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetLogInfoParams() *GetLogInfoParams {
- return &GetLogInfoParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewGetLogInfoParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetLogInfoParamsWithTimeout creates a new GetLogInfoParams object
// with the ability to set a timeout on a request.
func NewGetLogInfoParamsWithTimeout(timeout time.Duration) *GetLogInfoParams {
return &GetLogInfoParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewGetLogInfoParamsWithContext creates a new GetLogInfoParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogInfoParams].
func NewGetLogInfoParamsWithContext(ctx context.Context) *GetLogInfoParams {
return &GetLogInfoParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -73,9 +77,9 @@ GetLogInfoParams contains all the parameters to send to the API endpoint
Typically these are written to a http.Request.
*/
type GetLogInfoParams struct {
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the get log info params (not the query body).
@@ -93,43 +97,46 @@ func (o *GetLogInfoParams) SetDefaults() {
// no default values defined for this parameter
}
-// WithTimeout adds the timeout to the get log info params
+// WithTimeout adds the timeout to the get log info params.
func (o *GetLogInfoParams) WithTimeout(timeout time.Duration) *GetLogInfoParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the get log info params
+// SetTimeout adds the timeout to the get log info params.
func (o *GetLogInfoParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the get log info params
+// WithContext adds the context to the get log info params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogInfoParams].
func (o *GetLogInfoParams) WithContext(ctx context.Context) *GetLogInfoParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the get log info params
+// SetContext adds the context to the get log info params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogInfoParams].
func (o *GetLogInfoParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the get log info params
+// WithHTTPClient adds the HTTPClient to the get log info params.
func (o *GetLogInfoParams) WithHTTPClient(client *http.Client) *GetLogInfoParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the get log info params
+// SetHTTPClient adds the HTTPClient to the get log info params.
func (o *GetLogInfoParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetLogInfoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_responses.go
index 5b69389dec..0836c5d226 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -61,11 +60,9 @@ func NewGetLogInfoOK() *GetLogInfoOK {
return &GetLogInfoOK{}
}
-/*
-GetLogInfoOK describes a response with status code 200, with default header values.
-
-A JSON object with the root hash and tree size as properties
-*/
+// GetLogInfoOK describes a response with status code 200, with default header values.
+//
+// A JSON object with the root hash and tree size as properties
type GetLogInfoOK struct {
Payload *models.LogInfo
}
@@ -133,11 +130,9 @@ func NewGetLogInfoDefault(code int) *GetLogInfoDefault {
}
}
-/*
-GetLogInfoDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// GetLogInfoDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type GetLogInfoDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_parameters.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_parameters.go
index 505ca2cbb3..fb723a2989 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_parameters.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_parameters.go
@@ -27,7 +27,7 @@ import (
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/conv"
)
// NewGetLogProofParams creates a new GetLogProofParams object,
@@ -37,24 +37,28 @@ import (
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetLogProofParams() *GetLogProofParams {
- return &GetLogProofParams{
- timeout: cr.DefaultTimeout,
- }
+ return NewGetLogProofParamsWithTimeout(cr.DefaultTimeout)
}
// NewGetLogProofParamsWithTimeout creates a new GetLogProofParams object
// with the ability to set a timeout on a request.
func NewGetLogProofParamsWithTimeout(timeout time.Duration) *GetLogProofParams {
return &GetLogProofParams{
- timeout: timeout,
+ inner: innerParams{
+ timeout: timeout,
+ },
}
}
// NewGetLogProofParamsWithContext creates a new GetLogProofParams object
// with the ability to set a context for a request.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogProofParams].
func NewGetLogProofParamsWithContext(ctx context.Context) *GetLogProofParams {
return &GetLogProofParams{
- Context: ctx,
+ inner: innerParams{
+ ctx: ctx,
+ },
}
}
@@ -75,30 +79,27 @@ GetLogProofParams contains all the parameters to send to the API endpoint
*/
type GetLogProofParams struct {
- /* FirstSize.
-
- The size of the tree that you wish to prove consistency from (1 means the beginning of the log) Defaults to 1 if not specified
-
-
- Default: 1
- */
+ // FirstSize.
+ //
+ // The size of the tree that you wish to prove consistency from (1 means the beginning of the log) Defaults to 1 if not specified
+ //
+ //
+ // Default: 1
FirstSize *int64
- /* LastSize.
-
- The size of the tree that you wish to prove consistency to
- */
+ // LastSize.
+ //
+ // The size of the tree that you wish to prove consistency to
LastSize int64
- /* TreeID.
-
- The tree ID of the tree that you wish to prove consistency for
- */
+ // TreeID.
+ //
+ // The tree ID of the tree that you wish to prove consistency for
TreeID *string
- timeout time.Duration
- Context context.Context
HTTPClient *http.Client
+
+ inner innerParams
}
// WithDefaults hydrates default values in the get log proof params (not the query body).
@@ -121,82 +122,85 @@ func (o *GetLogProofParams) SetDefaults() {
FirstSize: &firstSizeDefault,
}
- val.timeout = o.timeout
- val.Context = o.Context
+ val.inner.timeout = o.inner.timeout
+ val.inner.ctx = o.inner.ctx
val.HTTPClient = o.HTTPClient
*o = val
}
-// WithTimeout adds the timeout to the get log proof params
+// WithTimeout adds the timeout to the get log proof params.
func (o *GetLogProofParams) WithTimeout(timeout time.Duration) *GetLogProofParams {
o.SetTimeout(timeout)
return o
}
-// SetTimeout adds the timeout to the get log proof params
+// SetTimeout adds the timeout to the get log proof params.
func (o *GetLogProofParams) SetTimeout(timeout time.Duration) {
- o.timeout = timeout
+ o.inner.timeout = timeout
}
-// WithContext adds the context to the get log proof params
+// WithContext adds the context to the get log proof params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogProofParams].
func (o *GetLogProofParams) WithContext(ctx context.Context) *GetLogProofParams {
o.SetContext(ctx)
return o
}
-// SetContext adds the context to the get log proof params
+// SetContext adds the context to the get log proof params.
+//
+// Deprecated: use the operation call with context to pass the context instead of [GetLogProofParams].
func (o *GetLogProofParams) SetContext(ctx context.Context) {
- o.Context = ctx
+ o.inner.ctx = ctx
}
-// WithHTTPClient adds the HTTPClient to the get log proof params
+// WithHTTPClient adds the HTTPClient to the get log proof params.
func (o *GetLogProofParams) WithHTTPClient(client *http.Client) *GetLogProofParams {
o.SetHTTPClient(client)
return o
}
-// SetHTTPClient adds the HTTPClient to the get log proof params
+// SetHTTPClient adds the HTTPClient to the get log proof params.
func (o *GetLogProofParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
-// WithFirstSize adds the firstSize to the get log proof params
+// WithFirstSize adds the firstSize to the get log proof params.
func (o *GetLogProofParams) WithFirstSize(firstSize *int64) *GetLogProofParams {
o.SetFirstSize(firstSize)
return o
}
-// SetFirstSize adds the firstSize to the get log proof params
+// SetFirstSize adds the firstSize to the get log proof params.
func (o *GetLogProofParams) SetFirstSize(firstSize *int64) {
o.FirstSize = firstSize
}
-// WithLastSize adds the lastSize to the get log proof params
+// WithLastSize adds the lastSize to the get log proof params.
func (o *GetLogProofParams) WithLastSize(lastSize int64) *GetLogProofParams {
o.SetLastSize(lastSize)
return o
}
-// SetLastSize adds the lastSize to the get log proof params
+// SetLastSize adds the lastSize to the get log proof params.
func (o *GetLogProofParams) SetLastSize(lastSize int64) {
o.LastSize = lastSize
}
-// WithTreeID adds the treeID to the get log proof params
+// WithTreeID adds the treeID to the get log proof params.
func (o *GetLogProofParams) WithTreeID(treeID *string) *GetLogProofParams {
o.SetTreeID(treeID)
return o
}
-// SetTreeID adds the treeId to the get log proof params
+// SetTreeID adds the treeId to the get log proof params.
func (o *GetLogProofParams) SetTreeID(treeID *string) {
o.TreeID = treeID
}
-// WriteToRequest writes these params to a swagger request
+// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetLogProofParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
-
- if err := r.SetTimeout(o.timeout); err != nil {
+ if err := r.SetTimeout(o.inner.timeout); err != nil {
return err
}
var res []error
@@ -209,7 +213,7 @@ func (o *GetLogProofParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
if o.FirstSize != nil {
qrFirstSize = *o.FirstSize
}
- qFirstSize := swag.FormatInt64(qrFirstSize)
+ qFirstSize := conv.FormatInteger(qrFirstSize)
if qFirstSize != "" {
if err := r.SetQueryParam("firstSize", qFirstSize); err != nil {
@@ -220,7 +224,7 @@ func (o *GetLogProofParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
// query param lastSize
qrLastSize := o.LastSize
- qLastSize := swag.FormatInt64(qrLastSize)
+ qLastSize := conv.FormatInteger(qrLastSize)
if qLastSize != "" {
if err := r.SetQueryParam("lastSize", qLastSize); err != nil {
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_responses.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_responses.go
index d025173d21..28b15da9a3 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_responses.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_responses.go
@@ -26,7 +26,6 @@ import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
-
"github.com/sigstore/rekor/pkg/generated/models"
)
@@ -67,11 +66,9 @@ func NewGetLogProofOK() *GetLogProofOK {
return &GetLogProofOK{}
}
-/*
-GetLogProofOK describes a response with status code 200, with default header values.
-
-All hashes required to compute the consistency proof
-*/
+// GetLogProofOK describes a response with status code 200, with default header values.
+//
+// All hashes required to compute the consistency proof
type GetLogProofOK struct {
Payload *models.ConsistencyProof
}
@@ -137,11 +134,9 @@ func NewGetLogProofBadRequest() *GetLogProofBadRequest {
return &GetLogProofBadRequest{}
}
-/*
-GetLogProofBadRequest describes a response with status code 400, with default header values.
-
-The content supplied to the server was invalid
-*/
+// GetLogProofBadRequest describes a response with status code 400, with default header values.
+//
+// The content supplied to the server was invalid
type GetLogProofBadRequest struct {
Payload *models.Error
}
@@ -209,11 +204,9 @@ func NewGetLogProofDefault(code int) *GetLogProofDefault {
}
}
-/*
-GetLogProofDefault describes a response with status code -1, with default header values.
-
-There was an internal error in the server while processing the request
-*/
+// GetLogProofDefault describes a response with status code -1, with default header values.
+//
+// There was an internal error in the server while processing the request
type GetLogProofDefault struct {
_statusCode int
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/tlog_client.go b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/tlog_client.go
index c58fe252c9..cd7f2a657f 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/tlog_client.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/tlog_client.go
@@ -19,17 +19,21 @@
package tlog
import (
+ "context"
+ "time"
+
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// New creates a new tlog API client.
-func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
+func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
// New creates a new tlog API client with basic auth credentials.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -43,6 +47,7 @@ func NewClientWithBasicAuth(host, basePath, scheme, user, password string) Clien
}
// New creates a new tlog API client with a bearer token for authentication.
+//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
@@ -54,36 +59,63 @@ func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) Client
return &Client{transport: transport, formats: strfmt.Default}
}
-/*
-Client for tlog API
-*/
+// Client for tlog API.
type Client struct {
- transport runtime.ClientTransport
+ transport runtime.ContextualTransport
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)
-// ClientService is the interface for Client methods
+// ClientService is the interface for Client methods.
type ClientService interface {
+
+ // GetLogInfo get information about the current state of the transparency log.
GetLogInfo(params *GetLogInfoParams, opts ...ClientOption) (*GetLogInfoOK, error)
+ // GetLogInfoContext get information about the current state of the transparency log.
+ GetLogInfoContext(ctx context.Context, params *GetLogInfoParams, opts ...ClientOption) (*GetLogInfoOK, error)
+
+ // GetLogProof get information required to generate a consistency proof for the transparency log.
GetLogProof(params *GetLogProofParams, opts ...ClientOption) (*GetLogProofOK, error)
- SetTransport(transport runtime.ClientTransport)
-}
+ // GetLogProofContext get information required to generate a consistency proof for the transparency log.
+ GetLogProofContext(ctx context.Context, params *GetLogProofParams, opts ...ClientOption) (*GetLogProofOK, error)
-/*
-GetLogInfo gets information about the current state of the transparency log
+ SetTransport(transport runtime.ContextualTransport)
+}
-Returns the current root hash and size of the merkle tree used to store the log entries.
-*/
+// GetLogInfo gets information about the current state of the transparency log.
+//
+// Returns the current root hash and size of the merkle tree used to store the log entries..
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.GetLogInfoContext] instead.
func (a *Client) GetLogInfo(params *GetLogInfoParams, opts ...ClientOption) (*GetLogInfoOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.GetLogInfoContext(ctx, params, opts...)
+}
+
+// GetLogInfoContext gets information about the current state of the transparency log.
+//
+// Returns the current root hash and size of the merkle tree used to store the log entries..
+//
+// Do not use the deprecated [GetLogInfoParams.Context] with this method: it would be ignored.
+func (a *Client) GetLogInfoContext(ctx context.Context, params *GetLogInfoParams, opts ...ClientOption) (*GetLogInfoOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewGetLogInfoParams()
}
+
op := &runtime.ClientOperation{
ID: "getLogInfo",
Method: "GET",
@@ -93,13 +125,14 @@ func (a *Client) GetLogInfo(params *GetLogInfoParams, opts ...ClientOption) (*Ge
Schemes: []string{"http"},
Params: params,
Reader: &GetLogInfoReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -118,16 +151,36 @@ func (a *Client) GetLogInfo(params *GetLogInfoParams, opts ...ClientOption) (*Ge
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
-/*
-GetLogProof gets information required to generate a consistency proof for the transparency log
-
-Returns a list of hashes for specified tree sizes that can be used to confirm the consistency of the transparency log
-*/
+// GetLogProof gets information required to generate a consistency proof for the transparency log.
+//
+// Returns a list of hashes for specified tree sizes that can be used to confirm the consistency of the transparency log.
+//
+// This method does not support injected context.
+// However, timeout and opentracing contexts are honored whenever enabled.
+//
+// If you need to pass a specific context, use [Client.GetLogProofContext] instead.
func (a *Client) GetLogProof(params *GetLogProofParams, opts ...ClientOption) (*GetLogProofOK, error) {
+ var ctx context.Context
+ if params != nil && params.inner.ctx != nil {
+ ctx = params.inner.ctx
+ } else {
+ ctx = context.Background()
+ }
+
+ return a.GetLogProofContext(ctx, params, opts...)
+}
+
+// GetLogProofContext gets information required to generate a consistency proof for the transparency log.
+//
+// Returns a list of hashes for specified tree sizes that can be used to confirm the consistency of the transparency log.
+//
+// Do not use the deprecated [GetLogProofParams.Context] with this method: it would be ignored.
+func (a *Client) GetLogProofContext(ctx context.Context, params *GetLogProofParams, opts ...ClientOption) (*GetLogProofOK, error) {
// NOTE: parameters are not validated before sending
if params == nil {
params = NewGetLogProofParams()
}
+
op := &runtime.ClientOperation{
ID: "getLogProof",
Method: "GET",
@@ -137,13 +190,14 @@ func (a *Client) GetLogProof(params *GetLogProofParams, opts ...ClientOption) (*
Schemes: []string{"http"},
Params: params,
Reader: &GetLogProofReader{formats: a.formats},
- Context: params.Context,
Client: params.HTTPClient,
}
+
for _, opt := range opts {
opt(op)
}
- result, err := a.transport.Submit(op)
+
+ result, err := a.transport.SubmitContext(ctx, op)
if err != nil {
return nil, err
}
@@ -163,6 +217,14 @@ func (a *Client) GetLogProof(params *GetLogProofParams, opts ...ClientOption) (*
}
// SetTransport changes the transport on the client
-func (a *Client) SetTransport(transport runtime.ClientTransport) {
+func (a *Client) SetTransport(transport runtime.ContextualTransport) {
a.transport = transport
}
+
+// innerParams captures internal fields so they don't conflict with user-supplied parameters.
+type innerParams struct {
+ timeout time.Duration
+
+ // Deprecated: use the operation call with context to pass the context instead of [TlogParams].
+ ctx context.Context
+}
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine.go
index d3c460e731..894cfab820 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Alpine) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this alpine
@@ -193,13 +193,13 @@ func (m *Alpine) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Alpine) UnmarshalBinary(b []byte) error {
var res Alpine
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine_v001_schema.go
index f748022d51..36a07c93b5 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/alpine_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -176,13 +177,13 @@ func (m *AlpineV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AlpineV001Schema) UnmarshalBinary(b []byte) error {
var res AlpineV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -221,7 +222,7 @@ func (m *AlpineV001SchemaPackage) Validate(formats strfmt.Registry) error {
}
func (m *AlpineV001SchemaPackage) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -265,7 +266,7 @@ func (m *AlpineV001SchemaPackage) contextValidateHash(ctx context.Context, forma
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -296,13 +297,13 @@ func (m *AlpineV001SchemaPackage) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AlpineV001SchemaPackage) UnmarshalBinary(b []byte) error {
var res AlpineV001SchemaPackage
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -406,13 +407,13 @@ func (m *AlpineV001SchemaPackageHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AlpineV001SchemaPackageHash) UnmarshalBinary(b []byte) error {
var res AlpineV001SchemaPackageHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -454,7 +455,7 @@ func (m *AlpineV001SchemaPublicKey) validateContent(formats strfmt.Registry) err
}
// ContextValidate validates this alpine v001 schema public key based on context it is used
-func (m *AlpineV001SchemaPublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *AlpineV001SchemaPublicKey) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -463,13 +464,13 @@ func (m *AlpineV001SchemaPublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AlpineV001SchemaPublicKey) UnmarshalBinary(b []byte) error {
var res AlpineV001SchemaPublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/consistency_proof.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/consistency_proof.go
index ae87d835ff..dbd722efaf 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/consistency_proof.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/consistency_proof.go
@@ -24,7 +24,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -92,7 +92,7 @@ func (m *ConsistencyProof) validateRootHash(formats strfmt.Registry) error {
}
// ContextValidate validates this consistency proof based on context it is used
-func (m *ConsistencyProof) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *ConsistencyProof) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -101,13 +101,13 @@ func (m *ConsistencyProof) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ConsistencyProof) UnmarshalBinary(b []byte) error {
var res ConsistencyProof
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/cose.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/cose.go
index 58cd4e3b1c..17675abef0 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/cose.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/cose.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Cose) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this cose
@@ -193,13 +193,13 @@ func (m *Cose) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Cose) UnmarshalBinary(b []byte) error {
var res Cose
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/cose_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/cose_v001_schema.go
index 69a3c0c65e..aa8378aaf4 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/cose_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/cose_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -68,7 +69,7 @@ func (m *CoseV001Schema) Validate(formats strfmt.Registry) error {
}
func (m *CoseV001Schema) validateData(formats strfmt.Registry) error {
- if swag.IsZero(m.Data) { // not required
+ if typeutils.IsZero(m.Data) { // not required
return nil
}
@@ -117,7 +118,7 @@ func (m *CoseV001Schema) contextValidateData(ctx context.Context, formats strfmt
if m.Data != nil {
- if swag.IsZero(m.Data) { // not required
+ if typeutils.IsZero(m.Data) { // not required
return nil
}
@@ -143,13 +144,13 @@ func (m *CoseV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CoseV001Schema) UnmarshalBinary(b []byte) error {
var res CoseV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -191,7 +192,7 @@ func (m *CoseV001SchemaData) Validate(formats strfmt.Registry) error {
}
func (m *CoseV001SchemaData) validateEnvelopeHash(formats strfmt.Registry) error {
- if swag.IsZero(m.EnvelopeHash) { // not required
+ if typeutils.IsZero(m.EnvelopeHash) { // not required
return nil
}
@@ -214,7 +215,7 @@ func (m *CoseV001SchemaData) validateEnvelopeHash(formats strfmt.Registry) error
}
func (m *CoseV001SchemaData) validatePayloadHash(formats strfmt.Registry) error {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -258,7 +259,7 @@ func (m *CoseV001SchemaData) contextValidateEnvelopeHash(ctx context.Context, fo
if m.EnvelopeHash != nil {
- if swag.IsZero(m.EnvelopeHash) { // not required
+ if typeutils.IsZero(m.EnvelopeHash) { // not required
return nil
}
@@ -283,7 +284,7 @@ func (m *CoseV001SchemaData) contextValidatePayloadHash(ctx context.Context, for
if m.PayloadHash != nil {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -309,13 +310,13 @@ func (m *CoseV001SchemaData) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CoseV001SchemaData) UnmarshalBinary(b []byte) error {
var res CoseV001SchemaData
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -419,13 +420,13 @@ func (m *CoseV001SchemaDataEnvelopeHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CoseV001SchemaDataEnvelopeHash) UnmarshalBinary(b []byte) error {
var res CoseV001SchemaDataEnvelopeHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -529,13 +530,13 @@ func (m *CoseV001SchemaDataPayloadHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CoseV001SchemaDataPayloadHash) UnmarshalBinary(b []byte) error {
var res CoseV001SchemaDataPayloadHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse.go
index 40b48b304e..2b9127fb2c 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m DSSE) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this dsse
@@ -193,13 +193,13 @@ func (m *DSSE) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DSSE) UnmarshalBinary(b []byte) error {
var res DSSE
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse_v001_schema.go
index efbcff1752..a184cfd4d9 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/dsse_v001_schema.go
@@ -26,7 +26,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -79,7 +80,7 @@ func (m *DSSEV001Schema) Validate(formats strfmt.Registry) error {
}
func (m *DSSEV001Schema) validateEnvelopeHash(formats strfmt.Registry) error {
- if swag.IsZero(m.EnvelopeHash) { // not required
+ if typeutils.IsZero(m.EnvelopeHash) { // not required
return nil
}
@@ -102,7 +103,7 @@ func (m *DSSEV001Schema) validateEnvelopeHash(formats strfmt.Registry) error {
}
func (m *DSSEV001Schema) validatePayloadHash(formats strfmt.Registry) error {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -125,7 +126,7 @@ func (m *DSSEV001Schema) validatePayloadHash(formats strfmt.Registry) error {
}
func (m *DSSEV001Schema) validateProposedContent(formats strfmt.Registry) error {
- if swag.IsZero(m.ProposedContent) { // not required
+ if typeutils.IsZero(m.ProposedContent) { // not required
return nil
}
@@ -148,7 +149,7 @@ func (m *DSSEV001Schema) validateProposedContent(formats strfmt.Registry) error
}
func (m *DSSEV001Schema) validateSignatures(formats strfmt.Registry) error {
- if swag.IsZero(m.Signatures) { // not required
+ if typeutils.IsZero(m.Signatures) { // not required
return nil
}
@@ -159,7 +160,7 @@ func (m *DSSEV001Schema) validateSignatures(formats strfmt.Registry) error {
}
for i := 0; i < len(m.Signatures); i++ {
- if swag.IsZero(m.Signatures[i]) { // not required
+ if typeutils.IsZero(m.Signatures[i]) { // not required
continue
}
@@ -213,7 +214,7 @@ func (m *DSSEV001Schema) contextValidateEnvelopeHash(ctx context.Context, format
if m.EnvelopeHash != nil {
- if swag.IsZero(m.EnvelopeHash) { // not required
+ if typeutils.IsZero(m.EnvelopeHash) { // not required
return nil
}
@@ -238,7 +239,7 @@ func (m *DSSEV001Schema) contextValidatePayloadHash(ctx context.Context, formats
if m.PayloadHash != nil {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -263,7 +264,7 @@ func (m *DSSEV001Schema) contextValidateProposedContent(ctx context.Context, for
if m.ProposedContent != nil {
- if swag.IsZero(m.ProposedContent) { // not required
+ if typeutils.IsZero(m.ProposedContent) { // not required
return nil
}
@@ -294,7 +295,7 @@ func (m *DSSEV001Schema) contextValidateSignatures(ctx context.Context, formats
if m.Signatures[i] != nil {
- if swag.IsZero(m.Signatures[i]) { // not required
+ if typeutils.IsZero(m.Signatures[i]) { // not required
return nil
}
@@ -322,13 +323,13 @@ func (m *DSSEV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DSSEV001Schema) UnmarshalBinary(b []byte) error {
var res DSSEV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -432,13 +433,13 @@ func (m *DSSEV001SchemaEnvelopeHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DSSEV001SchemaEnvelopeHash) UnmarshalBinary(b []byte) error {
var res DSSEV001SchemaEnvelopeHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -542,13 +543,13 @@ func (m *DSSEV001SchemaPayloadHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DSSEV001SchemaPayloadHash) UnmarshalBinary(b []byte) error {
var res DSSEV001SchemaPayloadHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -613,7 +614,7 @@ func (m *DSSEV001SchemaProposedContent) validateVerifiers(formats strfmt.Registr
}
// ContextValidate validates this DSSE v001 schema proposed content based on context it is used
-func (m *DSSEV001SchemaProposedContent) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *DSSEV001SchemaProposedContent) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -622,13 +623,13 @@ func (m *DSSEV001SchemaProposedContent) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DSSEV001SchemaProposedContent) UnmarshalBinary(b []byte) error {
var res DSSEV001SchemaProposedContent
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -692,7 +693,7 @@ func (m *DSSEV001SchemaSignaturesItems0) validateVerifier(formats strfmt.Registr
}
// ContextValidate validates this DSSE v001 schema signatures items0 based on context it is used
-func (m *DSSEV001SchemaSignaturesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *DSSEV001SchemaSignaturesItems0) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -701,13 +702,13 @@ func (m *DSSEV001SchemaSignaturesItems0) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DSSEV001SchemaSignaturesItems0) UnmarshalBinary(b []byte) error {
var res DSSEV001SchemaSignaturesItems0
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/error.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/error.go
index 6dcec446cf..4243953998 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/error.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/error.go
@@ -22,7 +22,7 @@ import (
"context"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
)
// Error error
@@ -38,12 +38,12 @@ type Error struct {
}
// Validate validates this error
-func (m *Error) Validate(formats strfmt.Registry) error {
+func (m *Error) Validate(_ strfmt.Registry) error {
return nil
}
// ContextValidate validates this error based on context it is used
-func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *Error) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -52,13 +52,13 @@ func (m *Error) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Error) UnmarshalBinary(b []byte) error {
var res Error
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord.go
index 1c2c48bdb3..c003669893 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Hashedrekord) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this hashedrekord
@@ -193,13 +193,13 @@ func (m *Hashedrekord) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Hashedrekord) UnmarshalBinary(b []byte) error {
var res Hashedrekord
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord_v001_schema.go
index 85b3fcbb31..81a7a0adc4 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/hashedrekord_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -176,13 +177,13 @@ func (m *HashedrekordV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HashedrekordV001Schema) UnmarshalBinary(b []byte) error {
var res HashedrekordV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -213,7 +214,7 @@ func (m *HashedrekordV001SchemaData) Validate(formats strfmt.Registry) error {
}
func (m *HashedrekordV001SchemaData) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -253,7 +254,7 @@ func (m *HashedrekordV001SchemaData) contextValidateHash(ctx context.Context, fo
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -279,13 +280,13 @@ func (m *HashedrekordV001SchemaData) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HashedrekordV001SchemaData) UnmarshalBinary(b []byte) error {
var res HashedrekordV001SchemaData
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -381,7 +382,7 @@ func (m *HashedrekordV001SchemaDataHash) validateValue(formats strfmt.Registry)
}
// ContextValidate validates this hashedrekord v001 schema data hash based on context it is used
-func (m *HashedrekordV001SchemaDataHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *HashedrekordV001SchemaDataHash) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -390,13 +391,13 @@ func (m *HashedrekordV001SchemaDataHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HashedrekordV001SchemaDataHash) UnmarshalBinary(b []byte) error {
var res HashedrekordV001SchemaDataHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -431,7 +432,7 @@ func (m *HashedrekordV001SchemaSignature) Validate(formats strfmt.Registry) erro
}
func (m *HashedrekordV001SchemaSignature) validatePublicKey(formats strfmt.Registry) error {
- if swag.IsZero(m.PublicKey) { // not required
+ if typeutils.IsZero(m.PublicKey) { // not required
return nil
}
@@ -471,7 +472,7 @@ func (m *HashedrekordV001SchemaSignature) contextValidatePublicKey(ctx context.C
if m.PublicKey != nil {
- if swag.IsZero(m.PublicKey) { // not required
+ if typeutils.IsZero(m.PublicKey) { // not required
return nil
}
@@ -497,13 +498,13 @@ func (m *HashedrekordV001SchemaSignature) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HashedrekordV001SchemaSignature) UnmarshalBinary(b []byte) error {
var res HashedrekordV001SchemaSignature
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -521,12 +522,12 @@ type HashedrekordV001SchemaSignaturePublicKey struct {
}
// Validate validates this hashedrekord v001 schema signature public key
-func (m *HashedrekordV001SchemaSignaturePublicKey) Validate(formats strfmt.Registry) error {
+func (m *HashedrekordV001SchemaSignaturePublicKey) Validate(_ strfmt.Registry) error {
return nil
}
// ContextValidate validates this hashedrekord v001 schema signature public key based on context it is used
-func (m *HashedrekordV001SchemaSignaturePublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *HashedrekordV001SchemaSignaturePublicKey) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -535,13 +536,13 @@ func (m *HashedrekordV001SchemaSignaturePublicKey) MarshalBinary() ([]byte, erro
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HashedrekordV001SchemaSignaturePublicKey) UnmarshalBinary(b []byte) error {
var res HashedrekordV001SchemaSignaturePublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/helm.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/helm.go
index 3cab983af8..1076a0d2b0 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/helm.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/helm.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Helm) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this helm
@@ -193,13 +193,13 @@ func (m *Helm) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Helm) UnmarshalBinary(b []byte) error {
var res Helm
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/helm_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/helm_v001_schema.go
index 3274e1d096..d350c7f5db 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/helm_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/helm_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -176,13 +177,13 @@ func (m *HelmV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HelmV001Schema) UnmarshalBinary(b []byte) error {
var res HelmV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -221,7 +222,7 @@ func (m *HelmV001SchemaChart) Validate(formats strfmt.Registry) error {
}
func (m *HelmV001SchemaChart) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -289,7 +290,7 @@ func (m *HelmV001SchemaChart) contextValidateHash(ctx context.Context, formats s
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -336,13 +337,13 @@ func (m *HelmV001SchemaChart) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HelmV001SchemaChart) UnmarshalBinary(b []byte) error {
var res HelmV001SchemaChart
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -446,13 +447,13 @@ func (m *HelmV001SchemaChartHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HelmV001SchemaChartHash) UnmarshalBinary(b []byte) error {
var res HelmV001SchemaChartHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -487,7 +488,7 @@ func (m *HelmV001SchemaChartProvenance) Validate(formats strfmt.Registry) error
}
func (m *HelmV001SchemaChartProvenance) validateSignature(formats strfmt.Registry) error {
- if swag.IsZero(m.Signature) { // not required
+ if typeutils.IsZero(m.Signature) { // not required
return nil
}
@@ -527,7 +528,7 @@ func (m *HelmV001SchemaChartProvenance) contextValidateSignature(ctx context.Con
if m.Signature != nil {
- if swag.IsZero(m.Signature) { // not required
+ if typeutils.IsZero(m.Signature) { // not required
return nil
}
@@ -553,13 +554,13 @@ func (m *HelmV001SchemaChartProvenance) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HelmV001SchemaChartProvenance) UnmarshalBinary(b []byte) error {
var res HelmV001SchemaChartProvenance
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -629,13 +630,13 @@ func (m *HelmV001SchemaChartProvenanceSignature) MarshalBinary() ([]byte, error)
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HelmV001SchemaChartProvenanceSignature) UnmarshalBinary(b []byte) error {
var res HelmV001SchemaChartProvenanceSignature
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -677,7 +678,7 @@ func (m *HelmV001SchemaPublicKey) validateContent(formats strfmt.Registry) error
}
// ContextValidate validates this helm v001 schema public key based on context it is used
-func (m *HelmV001SchemaPublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *HelmV001SchemaPublicKey) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -686,13 +687,13 @@ func (m *HelmV001SchemaPublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HelmV001SchemaPublicKey) UnmarshalBinary(b []byte) error {
var res HelmV001SchemaPublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/inactive_shard_log_info.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/inactive_shard_log_info.go
index 7cbcdc9c27..ddfec594ac 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/inactive_shard_log_info.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/inactive_shard_log_info.go
@@ -23,7 +23,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -127,7 +127,7 @@ func (m *InactiveShardLogInfo) validateTreeSize(formats strfmt.Registry) error {
}
// ContextValidate validates this inactive shard log info based on context it is used
-func (m *InactiveShardLogInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *InactiveShardLogInfo) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -136,13 +136,13 @@ func (m *InactiveShardLogInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *InactiveShardLogInfo) UnmarshalBinary(b []byte) error {
var res InactiveShardLogInfo
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/inclusion_proof.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/inclusion_proof.go
index a228b27f97..7955d82d75 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/inclusion_proof.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/inclusion_proof.go
@@ -24,7 +24,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -153,7 +153,7 @@ func (m *InclusionProof) validateTreeSize(formats strfmt.Registry) error {
}
// ContextValidate validates this inclusion proof based on context it is used
-func (m *InclusionProof) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *InclusionProof) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -162,13 +162,13 @@ func (m *InclusionProof) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *InclusionProof) UnmarshalBinary(b []byte) error {
var res InclusionProof
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto.go
index 6a79e48686..7b00668eaa 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Intoto) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this intoto
@@ -193,13 +193,13 @@ func (m *Intoto) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Intoto) UnmarshalBinary(b []byte) error {
var res Intoto
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v001_schema.go
index 912a34c522..9deb17b253 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -137,13 +138,13 @@ func (m *IntotoV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV001Schema) UnmarshalBinary(b []byte) error {
var res IntotoV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -184,7 +185,7 @@ func (m *IntotoV001SchemaContent) Validate(formats strfmt.Registry) error {
}
func (m *IntotoV001SchemaContent) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -207,7 +208,7 @@ func (m *IntotoV001SchemaContent) validateHash(formats strfmt.Registry) error {
}
func (m *IntotoV001SchemaContent) validatePayloadHash(formats strfmt.Registry) error {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -251,7 +252,7 @@ func (m *IntotoV001SchemaContent) contextValidateHash(ctx context.Context, forma
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -276,7 +277,7 @@ func (m *IntotoV001SchemaContent) contextValidatePayloadHash(ctx context.Context
if m.PayloadHash != nil {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -302,13 +303,13 @@ func (m *IntotoV001SchemaContent) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV001SchemaContent) UnmarshalBinary(b []byte) error {
var res IntotoV001SchemaContent
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -412,13 +413,13 @@ func (m *IntotoV001SchemaContentHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV001SchemaContentHash) UnmarshalBinary(b []byte) error {
var res IntotoV001SchemaContentHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -522,13 +523,13 @@ func (m *IntotoV001SchemaContentPayloadHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV001SchemaContentPayloadHash) UnmarshalBinary(b []byte) error {
var res IntotoV001SchemaContentPayloadHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v002_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v002_schema.go
index c3a4c959c5..ba2d96ae44 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v002_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/intoto_v002_schema.go
@@ -26,7 +26,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -120,13 +121,13 @@ func (m *IntotoV002Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV002Schema) UnmarshalBinary(b []byte) error {
var res IntotoV002Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -196,7 +197,7 @@ func (m *IntotoV002SchemaContent) validateEnvelope(formats strfmt.Registry) erro
}
func (m *IntotoV002SchemaContent) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -219,7 +220,7 @@ func (m *IntotoV002SchemaContent) validateHash(formats strfmt.Registry) error {
}
func (m *IntotoV002SchemaContent) validatePayloadHash(formats strfmt.Registry) error {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -288,7 +289,7 @@ func (m *IntotoV002SchemaContent) contextValidateHash(ctx context.Context, forma
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -313,7 +314,7 @@ func (m *IntotoV002SchemaContent) contextValidatePayloadHash(ctx context.Context
if m.PayloadHash != nil {
- if swag.IsZero(m.PayloadHash) { // not required
+ if typeutils.IsZero(m.PayloadHash) { // not required
return nil
}
@@ -339,13 +340,13 @@ func (m *IntotoV002SchemaContent) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV002SchemaContent) UnmarshalBinary(b []byte) error {
var res IntotoV002SchemaContent
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -411,7 +412,7 @@ func (m *IntotoV002SchemaContentEnvelope) validateSignatures(formats strfmt.Regi
}
for i := 0; i < len(m.Signatures); i++ {
- if swag.IsZero(m.Signatures[i]) { // not required
+ if typeutils.IsZero(m.Signatures[i]) { // not required
continue
}
@@ -455,7 +456,7 @@ func (m *IntotoV002SchemaContentEnvelope) contextValidateSignatures(ctx context.
if m.Signatures[i] != nil {
- if swag.IsZero(m.Signatures[i]) { // not required
+ if typeutils.IsZero(m.Signatures[i]) { // not required
return nil
}
@@ -483,13 +484,13 @@ func (m *IntotoV002SchemaContentEnvelope) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV002SchemaContentEnvelope) UnmarshalBinary(b []byte) error {
var res IntotoV002SchemaContentEnvelope
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -552,7 +553,7 @@ func (m *IntotoV002SchemaContentEnvelopeSignaturesItems0) validateSig(formats st
}
// ContextValidate validates this intoto v002 schema content envelope signatures items0 based on context it is used
-func (m *IntotoV002SchemaContentEnvelopeSignaturesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *IntotoV002SchemaContentEnvelopeSignaturesItems0) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -561,13 +562,13 @@ func (m *IntotoV002SchemaContentEnvelopeSignaturesItems0) MarshalBinary() ([]byt
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV002SchemaContentEnvelopeSignaturesItems0) UnmarshalBinary(b []byte) error {
var res IntotoV002SchemaContentEnvelopeSignaturesItems0
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -671,13 +672,13 @@ func (m *IntotoV002SchemaContentHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV002SchemaContentHash) UnmarshalBinary(b []byte) error {
var res IntotoV002SchemaContentHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -781,13 +782,13 @@ func (m *IntotoV002SchemaContentPayloadHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IntotoV002SchemaContentPayloadHash) UnmarshalBinary(b []byte) error {
var res IntotoV002SchemaContentPayloadHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/jar.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/jar.go
index 71d25cd701..a4fa52ba3e 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/jar.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/jar.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Jar) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this jar
@@ -193,13 +193,13 @@ func (m *Jar) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Jar) UnmarshalBinary(b []byte) error {
var res Jar
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/jar_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/jar_v001_schema.go
index f3808966b5..495aeaeaea 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/jar_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/jar_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -87,7 +88,7 @@ func (m *JarV001Schema) validateArchive(formats strfmt.Registry) error {
}
func (m *JarV001Schema) validateSignature(formats strfmt.Registry) error {
- if swag.IsZero(m.Signature) { // not required
+ if typeutils.IsZero(m.Signature) { // not required
return nil
}
@@ -152,7 +153,7 @@ func (m *JarV001Schema) contextValidateSignature(ctx context.Context, formats st
if m.Signature != nil {
- if swag.IsZero(m.Signature) { // not required
+ if typeutils.IsZero(m.Signature) { // not required
return nil
}
@@ -178,13 +179,13 @@ func (m *JarV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *JarV001Schema) UnmarshalBinary(b []byte) error {
var res JarV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -219,7 +220,7 @@ func (m *JarV001SchemaArchive) Validate(formats strfmt.Registry) error {
}
func (m *JarV001SchemaArchive) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -259,7 +260,7 @@ func (m *JarV001SchemaArchive) contextValidateHash(ctx context.Context, formats
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -285,13 +286,13 @@ func (m *JarV001SchemaArchive) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *JarV001SchemaArchive) UnmarshalBinary(b []byte) error {
var res JarV001SchemaArchive
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -381,7 +382,7 @@ func (m *JarV001SchemaArchiveHash) validateValue(formats strfmt.Registry) error
}
// ContextValidate validates this jar v001 schema archive hash based on context it is used
-func (m *JarV001SchemaArchiveHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *JarV001SchemaArchiveHash) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -390,13 +391,13 @@ func (m *JarV001SchemaArchiveHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *JarV001SchemaArchiveHash) UnmarshalBinary(b []byte) error {
var res JarV001SchemaArchiveHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -523,13 +524,13 @@ func (m *JarV001SchemaSignature) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *JarV001SchemaSignature) UnmarshalBinary(b []byte) error {
var res JarV001SchemaSignature
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -585,13 +586,13 @@ func (m *JarV001SchemaSignaturePublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *JarV001SchemaSignaturePublicKey) UnmarshalBinary(b []byte) error {
var res JarV001SchemaSignaturePublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/log_entry.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/log_entry.go
index bd25ee7378..1e51b1722c 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/log_entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/log_entry.go
@@ -24,7 +24,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -39,7 +40,7 @@ func (m LogEntry) Validate(formats strfmt.Registry) error {
for k := range m {
- if swag.IsZero(m[k]) { // not required
+ if typeutils.IsZero(m[k]) { // not required
continue
}
if val, ok := m[k]; ok {
@@ -150,7 +151,7 @@ func (m *LogEntryAnon) Validate(formats strfmt.Registry) error {
}
func (m *LogEntryAnon) validateAttestation(formats strfmt.Registry) error {
- if swag.IsZero(m.Attestation) { // not required
+ if typeutils.IsZero(m.Attestation) { // not required
return nil
}
@@ -217,7 +218,7 @@ func (m *LogEntryAnon) validateLogIndex(formats strfmt.Registry) error {
}
func (m *LogEntryAnon) validateVerification(formats strfmt.Registry) error {
- if swag.IsZero(m.Verification) { // not required
+ if typeutils.IsZero(m.Verification) { // not required
return nil
}
@@ -261,7 +262,7 @@ func (m *LogEntryAnon) contextValidateAttestation(ctx context.Context, formats s
if m.Attestation != nil {
- if swag.IsZero(m.Attestation) { // not required
+ if typeutils.IsZero(m.Attestation) { // not required
return nil
}
@@ -286,7 +287,7 @@ func (m *LogEntryAnon) contextValidateVerification(ctx context.Context, formats
if m.Verification != nil {
- if swag.IsZero(m.Verification) { // not required
+ if typeutils.IsZero(m.Verification) { // not required
return nil
}
@@ -312,13 +313,13 @@ func (m *LogEntryAnon) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LogEntryAnon) UnmarshalBinary(b []byte) error {
var res LogEntryAnon
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -336,12 +337,12 @@ type LogEntryAnonAttestation struct {
}
// Validate validates this log entry anon attestation
-func (m *LogEntryAnonAttestation) Validate(formats strfmt.Registry) error {
+func (m *LogEntryAnonAttestation) Validate(_ strfmt.Registry) error {
return nil
}
// ContextValidate validates this log entry anon attestation based on context it is used
-func (m *LogEntryAnonAttestation) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *LogEntryAnonAttestation) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -350,13 +351,13 @@ func (m *LogEntryAnonAttestation) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LogEntryAnonAttestation) UnmarshalBinary(b []byte) error {
var res LogEntryAnonAttestation
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -391,7 +392,7 @@ func (m *LogEntryAnonVerification) Validate(formats strfmt.Registry) error {
}
func (m *LogEntryAnonVerification) validateInclusionProof(formats strfmt.Registry) error {
- if swag.IsZero(m.InclusionProof) { // not required
+ if typeutils.IsZero(m.InclusionProof) { // not required
return nil
}
@@ -431,7 +432,7 @@ func (m *LogEntryAnonVerification) contextValidateInclusionProof(ctx context.Con
if m.InclusionProof != nil {
- if swag.IsZero(m.InclusionProof) { // not required
+ if typeutils.IsZero(m.InclusionProof) { // not required
return nil
}
@@ -457,13 +458,13 @@ func (m *LogEntryAnonVerification) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LogEntryAnonVerification) UnmarshalBinary(b []byte) error {
var res LogEntryAnonVerification
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/log_info.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/log_info.go
index b42dfbb24f..4ea1035ab6 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/log_info.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/log_info.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -88,12 +89,12 @@ func (m *LogInfo) Validate(formats strfmt.Registry) error {
}
func (m *LogInfo) validateInactiveShards(formats strfmt.Registry) error {
- if swag.IsZero(m.InactiveShards) { // not required
+ if typeutils.IsZero(m.InactiveShards) { // not required
return nil
}
for i := 0; i < len(m.InactiveShards); i++ {
- if swag.IsZero(m.InactiveShards[i]) { // not required
+ if typeutils.IsZero(m.InactiveShards[i]) { // not required
continue
}
@@ -185,7 +186,7 @@ func (m *LogInfo) contextValidateInactiveShards(ctx context.Context, formats str
if m.InactiveShards[i] != nil {
- if swag.IsZero(m.InactiveShards[i]) { // not required
+ if typeutils.IsZero(m.InactiveShards[i]) { // not required
return nil
}
@@ -213,13 +214,13 @@ func (m *LogInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *LogInfo) UnmarshalBinary(b []byte) error {
var res LogInfo
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/proposed_entry.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/proposed_entry.go
index 141730a18b..1af9a3c406 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/proposed_entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/proposed_entry.go
@@ -78,115 +78,73 @@ func UnmarshalProposedEntrySlice(reader io.Reader, consumer runtime.Consumer) ([
}
// UnmarshalProposedEntry unmarshals polymorphic ProposedEntry
-func UnmarshalProposedEntry(reader io.Reader, consumer runtime.Consumer) (ProposedEntry, error) {
- // we need to read this twice, so first into a buffer
- data, err := io.ReadAll(reader)
- if err != nil {
- return nil, err
- }
- return unmarshalProposedEntry(data, consumer)
+func UnmarshalProposedEntry(reader io.Reader, _ runtime.Consumer) (ProposedEntry, error) {
+ return fastUnmarshalTargetedProposedEntryReader(reader)
}
-func unmarshalProposedEntry(data []byte, consumer runtime.Consumer) (ProposedEntry, error) {
- buf := bytes.NewBuffer(data)
- buf2 := bytes.NewBuffer(data)
+type targetedProposedEntry struct {
+ Kind string `json:"kind"`
+ APIVersion *string `json:"apiVersion"`
+ Spec any `json:"spec"`
+}
- // the first time this is read is to fetch the value of the kind property.
- var getType struct {
- Kind string `json:"kind"`
- }
- if err := consumer.Consume(buf, &getType); err != nil {
+func fastUnmarshalTargetedProposedEntryReader(reader io.Reader) (ProposedEntry, error) {
+ var parsed targetedProposedEntry
+ dec := json.NewDecoder(reader)
+ dec.UseNumber()
+
+ if err := dec.Decode(&parsed); err != nil {
return nil, err
}
- if err := validate.RequiredString("kind", "body", getType.Kind); err != nil {
+ if err := validate.RequiredString("kind", "body", parsed.Kind); err != nil {
return nil, err
}
- // The value of kind is used to determine which type to create and unmarshal the data into
- switch getType.Kind {
+ switch parsed.Kind {
case "ProposedEntry":
- var result proposedEntry
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &proposedEntry{kindField: parsed.Kind}, nil
case "alpine":
- var result Alpine
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Alpine{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "cose":
- var result Cose
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Cose{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "dsse":
- var result DSSE
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &DSSE{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "hashedrekord":
- var result Hashedrekord
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Hashedrekord{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "helm":
- var result Helm
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Helm{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "intoto":
- var result Intoto
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Intoto{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "jar":
- var result Jar
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Jar{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "rekord":
- var result Rekord
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Rekord{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "rfc3161":
- var result Rfc3161
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Rfc3161{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "rpm":
- var result Rpm
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &Rpm{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
case "tuf":
- var result TUF
- if err := consumer.Consume(buf2, &result); err != nil {
- return nil, err
- }
- return &result, nil
+ return &TUF{APIVersion: parsed.APIVersion, Spec: parsed.Spec}, nil
+ default:
+ return nil, errors.New(422, "invalid kind value: %q", parsed.Kind)
}
- return nil, errors.New(422, "invalid kind value: %q", getType.Kind)
+}
+
+func fastUnmarshalTargetedProposedEntry(data []byte) (ProposedEntry, error) {
+ return fastUnmarshalTargetedProposedEntryReader(bytes.NewReader(data))
+}
+
+func unmarshalProposedEntry(data []byte, _ runtime.Consumer) (ProposedEntry, error) {
+ return fastUnmarshalTargetedProposedEntry(data)
}
// Validate validates this proposed entry
-func (m *proposedEntry) Validate(formats strfmt.Registry) error {
+func (m *proposedEntry) Validate(_ strfmt.Registry) error {
return nil
}
// ContextValidate validates this proposed entry based on context it is used
-func (m *proposedEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *proposedEntry) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord.go
index d862850726..ee53e97211 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Rekord) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this rekord
@@ -193,13 +193,13 @@ func (m *Rekord) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Rekord) UnmarshalBinary(b []byte) error {
var res Rekord
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord_v001_schema.go
index ab3a323369..7dc6c56f09 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/rekord_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -176,13 +177,13 @@ func (m *RekordV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RekordV001Schema) UnmarshalBinary(b []byte) error {
var res RekordV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -217,7 +218,7 @@ func (m *RekordV001SchemaData) Validate(formats strfmt.Registry) error {
}
func (m *RekordV001SchemaData) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -257,7 +258,7 @@ func (m *RekordV001SchemaData) contextValidateHash(ctx context.Context, formats
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -283,13 +284,13 @@ func (m *RekordV001SchemaData) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RekordV001SchemaData) UnmarshalBinary(b []byte) error {
var res RekordV001SchemaData
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -393,13 +394,13 @@ func (m *RekordV001SchemaDataHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RekordV001SchemaDataHash) UnmarshalBinary(b []byte) error {
var res RekordV001SchemaDataHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -570,13 +571,13 @@ func (m *RekordV001SchemaSignature) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RekordV001SchemaSignature) UnmarshalBinary(b []byte) error {
var res RekordV001SchemaSignature
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -618,7 +619,7 @@ func (m *RekordV001SchemaSignaturePublicKey) validateContent(formats strfmt.Regi
}
// ContextValidate validates this rekord v001 schema signature public key based on context it is used
-func (m *RekordV001SchemaSignaturePublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *RekordV001SchemaSignaturePublicKey) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -627,13 +628,13 @@ func (m *RekordV001SchemaSignaturePublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RekordV001SchemaSignaturePublicKey) UnmarshalBinary(b []byte) error {
var res RekordV001SchemaSignaturePublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161.go
index b18aa31a72..29b67da7e0 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Rfc3161) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this rfc3161
@@ -193,13 +193,13 @@ func (m *Rfc3161) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Rfc3161) UnmarshalBinary(b []byte) error {
var res Rfc3161
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161_v001_schema.go
index a2d7a3642a..ca328df328 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/rfc3161_v001_schema.go
@@ -24,7 +24,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -118,13 +118,13 @@ func (m *Rfc3161V001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Rfc3161V001Schema) UnmarshalBinary(b []byte) error {
var res Rfc3161V001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -166,7 +166,7 @@ func (m *Rfc3161V001SchemaTsr) validateContent(formats strfmt.Registry) error {
}
// ContextValidate validates this rfc3161 v001 schema tsr based on context it is used
-func (m *Rfc3161V001SchemaTsr) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *Rfc3161V001SchemaTsr) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -175,13 +175,13 @@ func (m *Rfc3161V001SchemaTsr) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Rfc3161V001SchemaTsr) UnmarshalBinary(b []byte) error {
var res Rfc3161V001SchemaTsr
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm.go
index 4ff2a264ee..614e5af906 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m Rpm) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this rpm
@@ -193,13 +193,13 @@ func (m *Rpm) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Rpm) UnmarshalBinary(b []byte) error {
var res Rpm
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm_v001_schema.go
index 4506414a4e..3d53a6015a 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/rpm_v001_schema.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -176,13 +177,13 @@ func (m *RpmV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RpmV001Schema) UnmarshalBinary(b []byte) error {
var res RpmV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -221,7 +222,7 @@ func (m *RpmV001SchemaPackage) Validate(formats strfmt.Registry) error {
}
func (m *RpmV001SchemaPackage) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -265,7 +266,7 @@ func (m *RpmV001SchemaPackage) contextValidateHash(ctx context.Context, formats
if m.Hash != nil {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -296,13 +297,13 @@ func (m *RpmV001SchemaPackage) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RpmV001SchemaPackage) UnmarshalBinary(b []byte) error {
var res RpmV001SchemaPackage
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -392,7 +393,7 @@ func (m *RpmV001SchemaPackageHash) validateValue(formats strfmt.Registry) error
}
// ContextValidate validates this rpm v001 schema package hash based on context it is used
-func (m *RpmV001SchemaPackageHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *RpmV001SchemaPackageHash) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -401,13 +402,13 @@ func (m *RpmV001SchemaPackageHash) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RpmV001SchemaPackageHash) UnmarshalBinary(b []byte) error {
var res RpmV001SchemaPackageHash
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -449,7 +450,7 @@ func (m *RpmV001SchemaPublicKey) validateContent(formats strfmt.Registry) error
}
// ContextValidate validates this rpm v001 schema public key based on context it is used
-func (m *RpmV001SchemaPublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *RpmV001SchemaPublicKey) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -458,13 +459,13 @@ func (m *RpmV001SchemaPublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RpmV001SchemaPublicKey) UnmarshalBinary(b []byte) error {
var res RpmV001SchemaPublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/search_index.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/search_index.go
index ff672558a4..dd08f13e0b 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/search_index.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/search_index.go
@@ -25,7 +25,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -48,6 +49,11 @@ type SearchIndex struct {
// public key
PublicKey *SearchIndexPublicKey `json:"publicKey,omitempty"`
+
+ // A SAN value (URI, DNS, IP, OtherName) as stored on the entry. Lookup is case-insensitive — e.g. a GitHub OIDC SAN such as `https://github.com/owner/repo/.github/workflows/build.yml@refs/heads/main`.
+ // Max Length: 512
+ // Min Length: 1
+ Subject string `json:"subject,omitempty"`
}
// Validate validates this search index
@@ -70,6 +76,10 @@ func (m *SearchIndex) Validate(formats strfmt.Registry) error {
res = append(res, err)
}
+ if err := m.validateSubject(formats); err != nil {
+ res = append(res, err)
+ }
+
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
@@ -77,7 +87,7 @@ func (m *SearchIndex) Validate(formats strfmt.Registry) error {
}
func (m *SearchIndex) validateEmail(formats strfmt.Registry) error {
- if swag.IsZero(m.Email) { // not required
+ if typeutils.IsZero(m.Email) { // not required
return nil
}
@@ -89,7 +99,7 @@ func (m *SearchIndex) validateEmail(formats strfmt.Registry) error {
}
func (m *SearchIndex) validateHash(formats strfmt.Registry) error {
- if swag.IsZero(m.Hash) { // not required
+ if typeutils.IsZero(m.Hash) { // not required
return nil
}
@@ -130,7 +140,7 @@ func (m *SearchIndex) validateOperatorEnum(path, location string, value string)
}
func (m *SearchIndex) validateOperator(formats strfmt.Registry) error {
- if swag.IsZero(m.Operator) { // not required
+ if typeutils.IsZero(m.Operator) { // not required
return nil
}
@@ -143,7 +153,7 @@ func (m *SearchIndex) validateOperator(formats strfmt.Registry) error {
}
func (m *SearchIndex) validatePublicKey(formats strfmt.Registry) error {
- if swag.IsZero(m.PublicKey) { // not required
+ if typeutils.IsZero(m.PublicKey) { // not required
return nil
}
@@ -165,6 +175,22 @@ func (m *SearchIndex) validatePublicKey(formats strfmt.Registry) error {
return nil
}
+func (m *SearchIndex) validateSubject(formats strfmt.Registry) error {
+ if typeutils.IsZero(m.Subject) { // not required
+ return nil
+ }
+
+ if err := validate.MinLength("subject", "body", m.Subject, 1); err != nil {
+ return err
+ }
+
+ if err := validate.MaxLength("subject", "body", m.Subject, 512); err != nil {
+ return err
+ }
+
+ return nil
+}
+
// ContextValidate validate this search index based on the context it is used
func (m *SearchIndex) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
@@ -183,7 +209,7 @@ func (m *SearchIndex) contextValidatePublicKey(ctx context.Context, formats strf
if m.PublicKey != nil {
- if swag.IsZero(m.PublicKey) { // not required
+ if typeutils.IsZero(m.PublicKey) { // not required
return nil
}
@@ -209,13 +235,13 @@ func (m *SearchIndex) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SearchIndex) UnmarshalBinary(b []byte) error {
var res SearchIndex
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -304,7 +330,7 @@ func (m *SearchIndexPublicKey) validateFormat(formats strfmt.Registry) error {
}
// ContextValidate validates this search index public key based on context it is used
-func (m *SearchIndexPublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *SearchIndexPublicKey) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -313,13 +339,13 @@ func (m *SearchIndexPublicKey) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SearchIndexPublicKey) UnmarshalBinary(b []byte) error {
var res SearchIndexPublicKey
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/search_log_query.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/search_log_query.go
index 874f51f07e..40b97b5046 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/search_log_query.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/search_log_query.go
@@ -29,7 +29,8 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
+ "github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
@@ -129,7 +130,7 @@ func (m SearchLogQuery) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this search log query
@@ -155,7 +156,7 @@ func (m *SearchLogQuery) Validate(formats strfmt.Registry) error {
}
func (m *SearchLogQuery) validateEntries(formats strfmt.Registry) error {
- if swag.IsZero(m.Entries()) { // not required
+ if typeutils.IsZero(m.Entries()) { // not required
return nil
}
@@ -190,7 +191,7 @@ func (m *SearchLogQuery) validateEntries(formats strfmt.Registry) error {
}
func (m *SearchLogQuery) validateEntryUUIDs(formats strfmt.Registry) error {
- if swag.IsZero(m.EntryUUIDs) { // not required
+ if typeutils.IsZero(m.EntryUUIDs) { // not required
return nil
}
@@ -216,7 +217,7 @@ func (m *SearchLogQuery) validateEntryUUIDs(formats strfmt.Registry) error {
}
func (m *SearchLogQuery) validateLogIndexes(formats strfmt.Registry) error {
- if swag.IsZero(m.LogIndexes) { // not required
+ if typeutils.IsZero(m.LogIndexes) { // not required
return nil
}
@@ -231,7 +232,7 @@ func (m *SearchLogQuery) validateLogIndexes(formats strfmt.Registry) error {
}
for i := 0; i < len(m.LogIndexes); i++ {
- if swag.IsZero(m.LogIndexes[i]) { // not required
+ if typeutils.IsZero(m.LogIndexes[i]) { // not required
continue
}
@@ -262,7 +263,7 @@ func (m *SearchLogQuery) contextValidateEntries(ctx context.Context, formats str
for i := 0; i < len(m.Entries()); i++ {
- if swag.IsZero(m.entriesField[i]) { // not required
+ if typeutils.IsZero(m.entriesField[i]) { // not required
return nil
}
@@ -289,13 +290,13 @@ func (m *SearchLogQuery) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SearchLogQuery) UnmarshalBinary(b []byte) error {
var res SearchLogQuery
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf.go
index 98997da594..9199656143 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf.go
@@ -25,7 +25,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -135,7 +135,7 @@ func (m TUF) MarshalJSON() ([]byte, error) {
return nil, err
}
- return swag.ConcatJSON(b1, b2, b3), nil
+ return jsonutils.ConcatJSON(b1, b2, b3), nil
}
// Validate validates this tuf
@@ -193,13 +193,13 @@ func (m *TUF) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TUF) UnmarshalBinary(b []byte) error {
var res TUF
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf_v001_schema.go b/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf_v001_schema.go
index b66058702c..3146f7c081 100644
--- a/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf_v001_schema.go
+++ b/vendor/github.com/sigstore/rekor/pkg/generated/models/tuf_v001_schema.go
@@ -24,7 +24,7 @@ import (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
@@ -192,13 +192,13 @@ func (m *TUFV001Schema) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TUFV001Schema) UnmarshalBinary(b []byte) error {
var res TUFV001Schema
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -239,7 +239,7 @@ func (m *TUFV001SchemaMetadata) validateContent(formats strfmt.Registry) error {
}
// ContextValidate validates this TUF v001 schema metadata based on context it is used
-func (m *TUFV001SchemaMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *TUFV001SchemaMetadata) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -248,13 +248,13 @@ func (m *TUFV001SchemaMetadata) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TUFV001SchemaMetadata) UnmarshalBinary(b []byte) error {
var res TUFV001SchemaMetadata
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
@@ -295,7 +295,7 @@ func (m *TUFV001SchemaRoot) validateContent(formats strfmt.Registry) error {
}
// ContextValidate validates this TUF v001 schema root based on context it is used
-func (m *TUFV001SchemaRoot) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+func (m *TUFV001SchemaRoot) ContextValidate(_ context.Context, _ strfmt.Registry) error {
return nil
}
@@ -304,13 +304,13 @@ func (m *TUFV001SchemaRoot) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
- return swag.WriteJSON(m)
+ return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TUFV001SchemaRoot) UnmarshalBinary(b []byte) error {
var res TUFV001SchemaRoot
- if err := swag.ReadJSON(b, &res); err != nil {
+ if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/identity/identity.go b/vendor/github.com/sigstore/rekor/pkg/pki/identity/identity.go
index 4566e1ddfe..6bf0740c71 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/identity/identity.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/identity/identity.go
@@ -20,7 +20,7 @@ type Identity struct {
// - *ecdsa.PublicKey
// - ed25519.PublicKey
// - *x509.Certificate
- // - openpgp.EntityList (golang.org/x/crypto/openpgp)
+ // - openpgp.EntityList (github.com/ProtonMail/go-crypto/openpgp)
// - *minisign.PublicKey (github.com/jedisct1/go-minisign)
// - ssh.PublicKey (golang.org/x/crypto/ssh)
Crypto any
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/minisign/minisign.go b/vendor/github.com/sigstore/rekor/pkg/pki/minisign/minisign.go
index df8f847c33..8ed5b75fa6 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/minisign/minisign.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/minisign/minisign.go
@@ -43,6 +43,10 @@ func NewSignature(r io.Reader) (*Signature, error) {
var s Signature
var inputBuffer bytes.Buffer
+ if r == nil {
+ return nil, errors.New("minisign signature reader cannot be nil")
+ }
+
if _, err := io.Copy(&inputBuffer, r); err != nil {
return nil, fmt.Errorf("unable to read minisign signature: %w", err)
}
@@ -92,13 +96,13 @@ func (s Signature) CanonicalValue() ([]byte, error) {
}
// Verify implements the pki.Signature interface
-func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOption) error {
+func (s Signature) Verify(r io.Reader, k any, opts ...sigsig.VerifyOption) error {
if s.signature == nil {
return errors.New("minisign signature has not been initialized")
}
key, ok := k.(*PublicKey)
- if !ok {
+ if !ok || key == nil {
return errors.New("cannot use Verify with a non-minisign key")
}
if key.key == nil {
@@ -112,12 +116,17 @@ func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOptio
prehashed := s.signature.SignatureAlgorithm[1] == 0x44
if prehashed {
+ if r == nil {
+ return errors.New("reading minisign data: reader cannot be nil")
+ }
h, _ := blake2b.New512(nil)
_, err := io.Copy(h, r)
if err != nil {
return errors.New("reading minisign data")
}
r = bytes.NewReader(h.Sum(nil))
+ } else if r == nil {
+ return errors.New("reading minisign data: reader cannot be nil")
}
return verifier.VerifySignature(bytes.NewReader(s.signature.Signature[:]), r, opts...)
@@ -133,6 +142,10 @@ func NewPublicKey(r io.Reader) (*PublicKey, error) {
var k PublicKey
var inputBuffer bytes.Buffer
+ if r == nil {
+ return nil, errors.New("minisign public key reader cannot be nil")
+ }
+
if _, err := io.Copy(&inputBuffer, r); err != nil {
return nil, fmt.Errorf("unable to read minisign public key: %w", err)
}
@@ -191,6 +204,9 @@ func (k PublicKey) Subjects() []string {
// Identities implements the pki.PublicKey interface
func (k PublicKey) Identities() ([]identity.Identity, error) {
+ if k.key == nil {
+ return nil, errors.New("minisign public key has not been initialized")
+ }
// PKIX encode ed25519 public key
pkixKey, err := cryptoutils.MarshalPublicKeyToDER(ed25519.PublicKey(k.key.PublicKey[:]))
if err != nil {
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/pgp/pgp.go b/vendor/github.com/sigstore/rekor/pkg/pki/pgp/pgp.go
index 53bb9fa73b..7a77a4c547 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/pgp/pgp.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/pgp/pgp.go
@@ -27,14 +27,13 @@ import (
"fmt"
"io"
"net/http"
+ "time"
+ "github.com/ProtonMail/go-crypto/openpgp"
+ "github.com/ProtonMail/go-crypto/openpgp/armor"
+ "github.com/ProtonMail/go-crypto/openpgp/packet"
"github.com/asaskevich/govalidator"
- //TODO: https://github.com/sigstore/rekor/issues/286
- "golang.org/x/crypto/openpgp" //nolint:staticcheck
- "golang.org/x/crypto/openpgp/armor" //nolint:staticcheck
- "golang.org/x/crypto/openpgp/packet" //nolint:staticcheck
-
"github.com/sigstore/rekor/pkg/pki/identity"
"github.com/sigstore/sigstore/pkg/cryptoutils"
sigsig "github.com/sigstore/sigstore/pkg/signature"
@@ -48,6 +47,10 @@ type Signature struct {
// NewSignature creates and validates a PGP signature object
func NewSignature(r io.Reader) (*Signature, error) {
+ if r == nil {
+ return nil, errors.New("nil reader")
+ }
+
var s Signature
var inputBuffer bytes.Buffer
@@ -80,9 +83,7 @@ func NewSignature(r io.Reader) (*Signature, error) {
}
if _, ok := sigPkt.(*packet.Signature); !ok {
- if _, ok := sigPkt.(*packet.SignatureV3); !ok {
- return nil, errors.New("valid PGP signature was not detected")
- }
+ return nil, errors.New("valid PGP signature was not detected")
}
s.signature = inputBuffer.Bytes()
@@ -149,16 +150,48 @@ func (s Signature) Verify(r io.Reader, k interface{}, _ ...sigsig.VerifyOption)
if !ok {
return errors.New("cannot use Verify with a non-PGP signature")
}
- if len(key.key) == 0 {
+ if key == nil || len(key.key) == 0 {
return errors.New("PGP public key has not been initialized")
}
- verifyFn := openpgp.CheckDetachedSignature
+ sigReader := bytes.NewReader(s.signature)
+ var (
+ sigPkt packet.Packet
+ err error
+ )
if s.isArmored {
- verifyFn = openpgp.CheckArmoredDetachedSignature
+ block, decodeErr := armor.Decode(sigReader)
+ if decodeErr != nil {
+ return fmt.Errorf("error decoding armored PGP signature: %w", decodeErr)
+ }
+ sigPkt, err = packet.Read(block.Body)
+ } else {
+ sigPkt, err = packet.Read(sigReader)
+ }
+ if err != nil {
+ return fmt.Errorf("error reading PGP signature: %w", err)
+ }
+ sig, ok := sigPkt.(*packet.Signature)
+ if !ok {
+ return errors.New("valid PGP signature was not detected")
}
- if _, err := verifyFn(key.key, r, bytes.NewReader(s.signature)); err != nil {
+ // ProtonMail's verifier checks key validity against Config.Time (default:
+ // now). Use the signature creation time so historically valid signatures
+ // still verify after key expiry, matching prior x/crypto/openpgp behavior
+ // needed for transparency-log replay and existing fixtures.
+ cfg := &packet.Config{
+ Time: func() time.Time { return sig.CreationTime },
+ }
+ if _, err := sigReader.Seek(0, io.SeekStart); err != nil {
+ return err
+ }
+ if s.isArmored {
+ _, err = openpgp.CheckArmoredDetachedSignature(key.key, r, sigReader, cfg)
+ } else {
+ _, err = openpgp.CheckDetachedSignature(key.key, r, sigReader, cfg)
+ }
+ if err != nil {
return err
}
@@ -172,6 +205,10 @@ type PublicKey struct {
// NewPublicKey implements the pki.PublicKey interface
func NewPublicKey(r io.Reader) (*PublicKey, error) {
+ if r == nil {
+ return nil, errors.New("nil reader")
+ }
+
var k PublicKey
var inputBuffer bytes.Buffer
@@ -215,6 +252,9 @@ func NewPublicKey(r io.Reader) (*PublicKey, error) {
}
}
}
+ if err := scan.Err(); err != nil {
+ return nil, fmt.Errorf("error reading PGP public key: %w", err)
+ }
} else {
// process as binary
k.key, err = openpgp.ReadKeyRing(bufferedReader)
@@ -269,6 +309,9 @@ func (k PublicKey) CanonicalValue() ([]byte, error) {
defer armoredWriter.Close()
for _, entity := range k.key {
+ if entity == nil {
+ return fmt.Errorf("pgp key ring contains a nil entity")
+ }
if err := entity.Serialize(armoredWriter); err != nil {
return fmt.Errorf("error generating canonical value of PGP public key: %w", err)
}
@@ -281,7 +324,8 @@ func (k PublicKey) CanonicalValue() ([]byte, error) {
return canonicalBuffer.Bytes(), nil
}
-func (k PublicKey) KeyRing() (openpgp.KeyRing, error) {
+// Entities returns the underlying OpenPGP entity list.
+func (k PublicKey) Entities() (openpgp.EntityList, error) {
if k.key == nil {
return nil, errors.New("PGP public key has not been initialized")
}
@@ -289,13 +333,21 @@ func (k PublicKey) KeyRing() (openpgp.KeyRing, error) {
return k.key, nil
}
+// KeyRing returns the underlying OpenPGP key ring.
+func (k PublicKey) KeyRing() (openpgp.KeyRing, error) {
+ return k.Entities()
+}
+
// EmailAddresses implements the pki.PublicKey interface
func (k PublicKey) EmailAddresses() []string {
var names []string
// Extract from cert
for _, entity := range k.key {
+ if entity == nil {
+ continue
+ }
for _, identity := range entity.Identities {
- if govalidator.IsEmail(identity.UserId.Email) {
+ if identity != nil && identity.UserId != nil && govalidator.IsEmail(identity.UserId.Email) {
names = append(names, identity.UserId.Email)
}
}
@@ -312,12 +364,22 @@ func (k PublicKey) Subjects() []string {
func (k PublicKey) Identities() ([]identity.Identity, error) {
var ids []identity.Identity
for _, entity := range k.key {
+ if entity == nil {
+ continue
+ }
var keys []*packet.PublicKey
- keys = append(keys, entity.PrimaryKey)
+ if entity.PrimaryKey != nil {
+ keys = append(keys, entity.PrimaryKey)
+ }
for _, subKey := range entity.Subkeys {
- keys = append(keys, subKey.PublicKey)
+ if subKey.PublicKey != nil {
+ keys = append(keys, subKey.PublicKey)
+ }
}
for _, pk := range keys {
+ if pk == nil {
+ continue
+ }
pubKey := pk.PublicKey
// Only process supported types. Will ignore DSA
// and ElGamal keys.
@@ -334,7 +396,7 @@ func (k PublicKey) Identities() ([]identity.Identity, error) {
ids = append(ids, identity.Identity{
Crypto: pubKey,
Raw: pkixKey,
- Fingerprint: hex.EncodeToString(pk.Fingerprint[:]),
+ Fingerprint: hex.EncodeToString(pk.Fingerprint),
})
}
}
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/pkcs7/pkcs7.go b/vendor/github.com/sigstore/rekor/pkg/pki/pkcs7/pkcs7.go
index c1fae6a706..9cb1b5f98a 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/pkcs7/pkcs7.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/pkcs7/pkcs7.go
@@ -29,7 +29,7 @@ import (
"io"
"strings"
- "github.com/sassoftware/relic/lib/pkcs7"
+ "github.com/sassoftware/relic/v8/lib/pkcs7"
"github.com/sigstore/rekor/pkg/pki/identity"
"github.com/sigstore/sigstore/pkg/cryptoutils"
sigsig "github.com/sigstore/sigstore/pkg/signature"
@@ -109,8 +109,8 @@ func (s Signature) CanonicalValue() ([]byte, error) {
}
// Verify implements the pki.Signature interface
-func (s Signature) Verify(r io.Reader, _ interface{}, _ ...sigsig.VerifyOption) error {
- if len(*s.raw) == 0 {
+func (s Signature) Verify(r io.Reader, _ any, _ ...sigsig.VerifyOption) error {
+ if s.raw == nil || len(*s.raw) == 0 {
return errors.New("PKCS7 signature has not been initialized")
}
@@ -206,7 +206,9 @@ func (k PublicKey) EmailAddresses() []string {
for _, name := range cert.Subject.Names {
if name.Type.Equal(EmailAddressOID) {
- names = append(names, strings.ToLower(name.Value.(string)))
+ if v, ok := name.Value.(string); ok {
+ names = append(names, strings.ToLower(v))
+ }
}
}
@@ -217,6 +219,9 @@ func (k PublicKey) EmailAddresses() []string {
func (k PublicKey) Subjects() []string {
// combine identities in the subject and SANs
identities := k.EmailAddresses()
+ if len(k.certs) == 0 {
+ return identities
+ }
cert, err := x509.ParseCertificate(k.certs[0].Raw)
if err != nil {
// This should not happen from a valid PublicKey, but fail gracefully.
@@ -228,6 +233,9 @@ func (k PublicKey) Subjects() []string {
// Identities implements the pki.PublicKey interface
func (k PublicKey) Identities() ([]identity.Identity, error) {
+ if k.key == nil || len(k.certs) == 0 {
+ return nil, errors.New("PKCS7 public key has not been initialized")
+ }
// pkcs7 structure may contain both a key and certificate chain
pkixKey, err := cryptoutils.MarshalPublicKeyToDER(k.key)
if err != nil {
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/ssh/sign.go b/vendor/github.com/sigstore/rekor/pkg/pki/ssh/sign.go
index 8d148f79fe..58de4f43b9 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/ssh/sign.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/ssh/sign.go
@@ -19,6 +19,7 @@ import (
"crypto/rand"
"crypto/sha256"
"crypto/sha512"
+ "errors"
"hash"
"io"
@@ -92,7 +93,7 @@ func Sign(sshPrivateKey string, data io.Reader) ([]byte, error) {
as, ok := s.(ssh.AlgorithmSigner)
if !ok {
- return nil, err
+ return nil, errors.New("ssh private key does not support algorithm signing")
}
sig, err := sign(as, data)
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/ssh/ssh.go b/vendor/github.com/sigstore/rekor/pkg/pki/ssh/ssh.go
index 252653a9bc..d275d06e30 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/ssh/ssh.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/ssh/ssh.go
@@ -54,6 +54,12 @@ func NewSignature(r io.Reader) (*Signature, error) {
// CanonicalValue implements the pki.Signature interface
func (s Signature) CanonicalValue() ([]byte, error) {
+ if s.signature == nil {
+ return nil, errors.New("ssh signature has not been initialized")
+ }
+ if s.pk == nil {
+ return nil, errors.New("ssh signature public key has not been initialized")
+ }
return []byte(Armor(s.signature, s.pk)), nil
}
@@ -64,7 +70,7 @@ func (s Signature) Verify(r io.Reader, k interface{}, _ ...sigsig.VerifyOption)
}
key, ok := k.(*PublicKey)
- if !ok {
+ if !ok || key == nil {
return fmt.Errorf("invalid public key type for: %v", k)
}
@@ -128,15 +134,26 @@ func (k PublicKey) Subjects() []string {
// Identities implements the pki.PublicKey interface
func (k PublicKey) Identities() ([]identity.Identity, error) {
+ if k.key == nil {
+ return nil, errors.New("ssh public key has not been initialized")
+ }
+
// extract key from SSH certificate if present
var sshKey ssh.PublicKey
switch v := k.key.(type) {
case *ssh.Certificate:
+ if v == nil {
+ return nil, errors.New("ssh certificate is nil")
+ }
sshKey = v.Key
default:
sshKey = k.key
}
+ if sshKey == nil {
+ return nil, errors.New("ssh public key is nil")
+ }
+
// Extract crypto.PublicKey from SSH key
// Handle sk public keys which do not implement ssh.CryptoPublicKey
// Inspired by x/ssh/keys.go
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/tuf/tuf.go b/vendor/github.com/sigstore/rekor/pkg/pki/tuf/tuf.go
index 6b7fefe13f..7cc551ed7a 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/tuf/tuf.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/tuf/tuf.go
@@ -88,7 +88,7 @@ func (s Signature) CanonicalValue() ([]byte, error) {
// Verify implements the pki.Signature interface
func (s Signature) Verify(_ io.Reader, k interface{}, _ ...sigsig.VerifyOption) error {
key, ok := k.(*PublicKey)
- if !ok {
+ if !ok || key == nil {
return fmt.Errorf("invalid public key type for: %v", k)
}
@@ -126,11 +126,17 @@ func NewPublicKey(r io.Reader) (*PublicKey, error) {
// Now create a verification db that trusts all the keys
db := verify.NewDB()
for id, k := range root.Keys {
+ if k == nil {
+ return nil, errors.New("tuf root contains nil key")
+ }
if err := db.AddKey(id, k); err != nil {
return nil, err
}
}
for name, role := range root.Roles {
+ if role == nil {
+ return nil, errors.New("tuf root contains nil role")
+ }
if err := db.AddRole(name, role); err != nil {
return nil, err
}
@@ -157,6 +163,9 @@ func (k PublicKey) CanonicalValue() (encoded []byte, err error) {
}
func (k PublicKey) SpecVersion() (string, error) {
+ if k.root == nil {
+ return "", errors.New("tuf root has not been initialized")
+ }
// extract role
sm := &signedMeta{}
if err := json.Unmarshal(k.root.Signed, sm); err != nil {
@@ -177,6 +186,9 @@ func (k PublicKey) Subjects() []string {
// Identities implements the pki.PublicKey interface
func (k PublicKey) Identities() ([]identity.Identity, error) {
+ if k.root == nil {
+ return nil, errors.New("tuf root has not been initialized")
+ }
root := &data.Root{}
if err := json.Unmarshal(k.root.Signed, root); err != nil {
return nil, err
diff --git a/vendor/github.com/sigstore/rekor/pkg/pki/x509/x509.go b/vendor/github.com/sigstore/rekor/pkg/pki/x509/x509.go
index 2cfaf81600..e2f18f5fa0 100644
--- a/vendor/github.com/sigstore/rekor/pkg/pki/x509/x509.go
+++ b/vendor/github.com/sigstore/rekor/pkg/pki/x509/x509.go
@@ -48,6 +48,9 @@ func NewSignature(r io.Reader) (*Signature, error) {
}
func NewSignatureWithOpts(r io.Reader, opts ...sigsig.LoadOption) (*Signature, error) {
+ if r == nil {
+ return nil, errors.New("reader cannot be nil")
+ }
b, err := io.ReadAll(r)
if err != nil {
return nil, err
@@ -71,7 +74,7 @@ func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOptio
}
key, ok := k.(*PublicKey)
- if !ok {
+ if !ok || key == nil {
return fmt.Errorf("invalid public key type for: %v", k)
}
@@ -111,6 +114,9 @@ type cert struct {
// NewPublicKey implements the pki.PublicKey interface
func NewPublicKey(r io.Reader) (*PublicKey, error) {
+ if r == nil {
+ return nil, errors.New("reader cannot be nil")
+ }
rawPub, err := io.ReadAll(r)
if err != nil {
return nil, err
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/dsse/dsse.go b/vendor/github.com/sigstore/rekor/pkg/types/dsse/dsse.go
index 9b82729672..c17c45e43b 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/dsse/dsse.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/dsse/dsse.go
@@ -43,7 +43,7 @@ func New() types.TypeImpl {
return &bit
}
-var VersionMap = types.NewSemVerEntryFactoryMap()
+var VersionMap = types.NewEntryFactoryMap()
func (it BaseDSSEType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImpl, error) {
if pe == nil {
@@ -54,6 +54,9 @@ func (it BaseDSSEType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImpl,
if !ok {
return nil, errors.New("cannot unmarshal non-DSSE types")
}
+ if in == nil {
+ return nil, errors.New("proposed entry cannot be nil")
+ }
if in.APIVersion == nil {
return nil, errors.New("api version cannot be nil")
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/dsse/v0.0.1/entry.go b/vendor/github.com/sigstore/rekor/pkg/types/dsse/v0.0.1/entry.go
index 2d43793309..3703adc20b 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/dsse/v0.0.1/entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/dsse/v0.0.1/entry.go
@@ -111,12 +111,12 @@ func (v V001Entry) IndexKeys() ([]string, error) {
result = append(result, keyObj.Subjects()...)
}
- if v.DSSEObj.PayloadHash != nil {
+ if v.DSSEObj.PayloadHash != nil && v.DSSEObj.PayloadHash.Algorithm != nil && v.DSSEObj.PayloadHash.Value != nil {
payloadHashKey := strings.ToLower(fmt.Sprintf("%s:%s", *v.DSSEObj.PayloadHash.Algorithm, *v.DSSEObj.PayloadHash.Value))
result = append(result, payloadHashKey)
}
- if v.DSSEObj.EnvelopeHash != nil {
+ if v.DSSEObj.EnvelopeHash != nil && v.DSSEObj.EnvelopeHash.Algorithm != nil && v.DSSEObj.EnvelopeHash.Value != nil {
envelopeHashKey := strings.ToLower(fmt.Sprintf("%s:%s", *v.DSSEObj.EnvelopeHash.Algorithm, *v.DSSEObj.EnvelopeHash.Value))
result = append(result, envelopeHashKey)
}
@@ -238,6 +238,9 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
if !ok {
return errors.New("cannot unmarshal non DSSE v0.0.1 type")
}
+ if it == nil {
+ return errors.New("proposed entry cannot be nil")
+ }
dsseObj := &models.DSSEV001Schema{}
@@ -285,7 +288,7 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
allPubKeyBytes = append(allPubKeyBytes, publicKey)
}
- sigToKeyMap, err := verifyEnvelope(allPubKeyBytes, env)
+ sigToKeyMap, decodedPayload, err := verifyEnvelope(allPubKeyBytes, env)
if err != nil {
return err
}
@@ -311,12 +314,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
})
}
- decodedPayload, err := env.DecodeB64Payload()
- if err != nil {
- // this shouldn't happen because failure would have occurred in verifyEnvelope call above
- return err
- }
-
// extraction of index keys - done here so we can clear the huge strings from memory
if env.PayloadType == in_toto.PayloadType {
var extract indexKeyExtract
@@ -429,6 +426,9 @@ func (v V001Entry) CreateFromArtifactProperties(_ context.Context, props types.A
if len(props.PublicKeyPaths) > 0 {
for _, path := range props.PublicKeyPaths {
+ if path == nil {
+ return nil, errors.New("public key path cannot be nil")
+ }
if path.IsAbs() {
return nil, errors.New("dsse public keys cannot be fetched over HTTP(S)")
}
@@ -442,7 +442,7 @@ func (v V001Entry) CreateFromArtifactProperties(_ context.Context, props types.A
}
}
- keysBySig, err := verifyEnvelope(allPubKeyBytes, env)
+ keysBySig, _, err := verifyEnvelope(allPubKeyBytes, env)
if err != nil {
return nil, err
}
@@ -464,7 +464,7 @@ func (v V001Entry) CreateFromArtifactProperties(_ context.Context, props types.A
// verifyEnvelope takes in an array of possible key bytes and attempts to parse them as x509 public keys.
// it then uses these to verify the envelope and makes sure that every signature on the envelope is verified.
// it returns a map of verifiers indexed by the signature the verifier corresponds to.
-func verifyEnvelope(allPubKeyBytes [][]byte, env *dsse.Envelope) (map[string]*x509.PublicKey, error) {
+func verifyEnvelope(allPubKeyBytes [][]byte, env *dsse.Envelope) (map[string]*x509.PublicKey, []byte, error) {
// generate a fake id for these keys so we can get back to the key bytes and match them to their corresponding signature
verifierBySig := make(map[string]*x509.PublicKey)
allSigs := make(map[string]struct{})
@@ -472,28 +472,33 @@ func verifyEnvelope(allPubKeyBytes [][]byte, env *dsse.Envelope) (map[string]*x5
allSigs[sig.Sig] = struct{}{}
}
+ var verifiedPayload []byte
for _, pubKeyBytes := range allPubKeyBytes {
if len(allSigs) == 0 {
break // if all signatures have been verified, do not attempt anymore
}
key, err := x509.NewPublicKey(bytes.NewReader(pubKeyBytes))
if err != nil {
- return nil, fmt.Errorf("could not parse public key as x509: %w", err)
+ return nil, nil, fmt.Errorf("could not parse public key as x509: %w", err)
}
vfr, err := signature.LoadVerifier(key.CryptoPubKey(), crypto.SHA256)
if err != nil {
- return nil, fmt.Errorf("could not load verifier: %w", err)
+ return nil, nil, fmt.Errorf("could not load verifier: %w", err)
}
dsseVfr, err := dsse.NewEnvelopeVerifier(&sigdsse.VerifierAdapter{SignatureVerifier: vfr})
if err != nil {
- return nil, fmt.Errorf("could not use public key as a dsse verifier: %w", err)
+ return nil, nil, fmt.Errorf("could not use public key as a dsse verifier: %w", err)
}
- accepted, err := dsseVfr.Verify(context.Background(), env)
+ accepted, payload, err := dsseVfr.VerifyAndDecode(context.Background(), env)
if err != nil {
- return nil, fmt.Errorf("could not verify envelope: %w", err)
+ return nil, nil, fmt.Errorf("could not verify envelope: %w", err)
+ }
+
+ if len(accepted) > 0 {
+ verifiedPayload = payload
}
for _, accept := range accepted {
@@ -503,10 +508,10 @@ func verifyEnvelope(allPubKeyBytes [][]byte, env *dsse.Envelope) (map[string]*x5
}
if len(allSigs) > 0 {
- return nil, errors.New("all signatures must have a key that verifies it")
+ return nil, nil, errors.New("all signatures must have a key that verifies it")
}
- return verifierBySig, nil
+ return verifierBySig, verifiedPayload, nil
}
func (v V001Entry) Verifiers() ([]pkitypes.PublicKey, error) {
@@ -516,6 +521,9 @@ func (v V001Entry) Verifiers() ([]pkitypes.PublicKey, error) {
var keys []pkitypes.PublicKey
for _, s := range v.DSSEObj.Signatures {
+ if s == nil || s.Verifier == nil {
+ return nil, errors.New("dsse v0.0.1 entry not initialized")
+ }
key, err := x509.NewPublicKey(bytes.NewReader(*s.Verifier))
if err != nil {
return nil, err
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/hashedrekord.go b/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/hashedrekord.go
index 778d9e5b44..6bbbc1f275 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/hashedrekord.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/hashedrekord.go
@@ -43,7 +43,7 @@ func New() types.TypeImpl {
return &brt
}
-var VersionMap = types.NewSemVerEntryFactoryMap()
+var VersionMap = types.NewEntryFactoryMap()
func (rt BaseRekordType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImpl, error) {
if pe == nil {
@@ -54,6 +54,9 @@ func (rt BaseRekordType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImp
if !ok {
return nil, fmt.Errorf("cannot unmarshal non-hashed Rekord types: %s", pe.Kind())
}
+ if rekord == nil {
+ return nil, errors.New("proposed entry cannot be nil")
+ }
if rekord.APIVersion == nil {
return nil, errors.New("api version cannot be nil")
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1/entry.go b/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1/entry.go
index 7d0ef04e61..e1c3092a3e 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1/entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1/entry.go
@@ -67,6 +67,13 @@ func NewEntry() types.EntryImpl {
func (v V001Entry) IndexKeys() ([]string, error) {
var result []string
+ if v.HashedRekordObj.Signature == nil {
+ return nil, errors.New("hashedrekord v0.0.1 entry not initialized")
+ }
+ if v.HashedRekordObj.Signature.PublicKey == nil {
+ return nil, errors.New("hashedrekord v0.0.1 entry not initialized")
+ }
+
key := v.HashedRekordObj.Signature.PublicKey.Content
keyHash := sha256.Sum256(key)
result = append(result, strings.ToLower(hex.EncodeToString(keyHash[:])))
@@ -77,7 +84,8 @@ func (v V001Entry) IndexKeys() ([]string, error) {
}
result = append(result, pub.Subjects()...)
- if v.HashedRekordObj.Data.Hash != nil {
+ if v.HashedRekordObj.Data != nil && v.HashedRekordObj.Data.Hash != nil &&
+ v.HashedRekordObj.Data.Hash.Algorithm != nil && v.HashedRekordObj.Data.Hash.Value != nil {
hashKey := strings.ToLower(fmt.Sprintf("%s:%s", *v.HashedRekordObj.Data.Hash.Algorithm, *v.HashedRekordObj.Data.Hash.Value))
result = append(result, hashKey)
}
@@ -150,6 +158,9 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
if !ok {
return errors.New("cannot unmarshal non Rekord v0.0.1 type")
}
+ if rekord == nil {
+ return errors.New("proposed entry cannot be nil")
+ }
if err := DecodeEntry(rekord.Spec, &v.HashedRekordObj); err != nil {
return err
@@ -231,6 +242,10 @@ func (v *V001Entry) validate() (pkitypes.Signature, pkitypes.PublicKey, error) {
return nil, nil, &types.InputValidationError{Err: errors.New("missing hash")}
}
+ if hash.Value == nil {
+ return nil, nil, &types.InputValidationError{Err: errors.New("missing hash value")}
+ }
+
var alg crypto.Hash
switch conv.Value(hash.Algorithm) {
case models.HashedrekordV001SchemaDataHashAlgorithmSha384:
@@ -301,7 +316,7 @@ func (v V001Entry) CreateFromArtifactProperties(_ context.Context, props types.A
re.HashedRekordObj.Signature.PublicKey = &models.HashedrekordV001SchemaSignaturePublicKey{}
publicKeyBytes := props.PublicKeyBytes
if len(publicKeyBytes) == 0 {
- if len(props.PublicKeyPaths) != 1 {
+ if len(props.PublicKeyPaths) != 1 || props.PublicKeyPaths[0] == nil {
return nil, errors.New("only one public key must be provided to verify detached signature")
}
keyBytes, err := os.ReadFile(filepath.Clean(props.PublicKeyPaths[0].Path))
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/intoto/intoto.go b/vendor/github.com/sigstore/rekor/pkg/types/intoto/intoto.go
index 8aa2b8ddc9..b4d0234cbe 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/intoto/intoto.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/intoto/intoto.go
@@ -45,7 +45,7 @@ func New() types.TypeImpl {
return &bit
}
-var VersionMap = types.NewSemVerEntryFactoryMap()
+var VersionMap = types.NewEntryFactoryMap()
func (it BaseIntotoType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImpl, error) {
if pe == nil {
@@ -54,7 +54,7 @@ func (it BaseIntotoType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImp
in, ok := pe.(*models.Intoto)
if !ok {
- return nil, errors.New("cannot unmarshal non-Rekord types")
+ return nil, errors.New("cannot unmarshal non-Intoto types")
}
if in.APIVersion == nil {
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.1/entry.go b/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.1/entry.go
index 7f16911881..b150bd5ba6 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.1/entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.1/entry.go
@@ -140,8 +140,17 @@ func (v V001Entry) IndexKeys() ([]string, error) {
return result, nil
}
-func parseStatement(p string) (*in_toto.Statement, error) {
- ps := in_toto.Statement{}
+// indexKeyExtract captures only the fields of an in-toto statement that are
+// used to derive index keys; it intentionally uses encoding/json semantics so
+// that payloads accepted today continue to parse identically.
+type indexKeyExtract struct {
+ Subject []struct {
+ Digest map[string]string `json:"digest"`
+ } `json:"subject"`
+}
+
+func parseStatement(p string) (*indexKeyExtract, error) {
+ ps := indexKeyExtract{}
payload, err := base64.StdEncoding.DecodeString(p)
if err != nil {
return nil, err
@@ -238,6 +247,9 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
return err
}
+ if v.IntotoObj.PublicKey == nil {
+ return errors.New("missing public key in intoto v0.0.1 entry")
+ }
v.keyObj, err = x509.NewPublicKey(bytes.NewReader(*v.IntotoObj.PublicKey))
if err != nil {
return err
@@ -291,7 +303,14 @@ func (v *V001Entry) Canonicalize(_ context.Context) ([]byte, error) {
// validate performs cross-field validation for fields in object
func (v *V001Entry) validate() error {
// TODO handle multiple
- pk := v.keyObj.(*x509.PublicKey)
+ pk, ok := v.keyObj.(*x509.PublicKey)
+ if !ok {
+ return errors.New("public key is not of type *x509.PublicKey")
+ }
+
+ if v.IntotoObj.Content == nil {
+ return errors.New("missing content in intoto v0.0.1 entry")
+ }
// one of two cases must be true:
// - ProposedEntry: client gives an envelope; (client provided hash/payloadhash are ignored as they are computed server-side) OR
@@ -346,7 +365,7 @@ func (v *V001Entry) validate() error {
// AttestationKey returns the digest of the attestation that was uploaded, to be used to lookup the attestation from storage
func (v *V001Entry) AttestationKey() string {
- if v.IntotoObj.Content != nil && v.IntotoObj.Content.PayloadHash != nil {
+ if v.IntotoObj.Content != nil && v.IntotoObj.Content.PayloadHash != nil && v.IntotoObj.Content.PayloadHash.Algorithm != nil && v.IntotoObj.Content.PayloadHash.Value != nil {
return fmt.Sprintf("%s:%s", *v.IntotoObj.Content.PayloadHash.Algorithm, *v.IntotoObj.Content.PayloadHash.Value)
}
return ""
@@ -385,6 +404,9 @@ func (v V001Entry) CreateFromArtifactProperties(_ context.Context, props types.A
if len(props.PublicKeyPaths) != 1 {
return nil, errors.New("only one public key must be provided to verify signature")
}
+ if props.PublicKeyPaths[0] == nil {
+ return nil, errors.New("public key path cannot be nil")
+ }
keyBytes, err := os.ReadFile(filepath.Clean(props.PublicKeyPaths[0].Path))
if err != nil {
return nil, fmt.Errorf("error reading public key file: %w", err)
@@ -429,7 +451,7 @@ func (v V001Entry) Verifiers() ([]pkitypes.PublicKey, error) {
func (v V001Entry) ArtifactHash() (string, error) {
if v.IntotoObj.Content == nil || v.IntotoObj.Content.PayloadHash == nil || v.IntotoObj.Content.PayloadHash.Algorithm == nil || v.IntotoObj.Content.PayloadHash.Value == nil {
- return "", errors.New("hashedrekord v0.0.1 entry not initialized")
+ return "", errors.New("intoto v0.0.1 entry not initialized")
}
return strings.ToLower(fmt.Sprintf("%s:%s", *v.IntotoObj.Content.PayloadHash.Algorithm, *v.IntotoObj.Content.PayloadHash.Value)), nil
}
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.2/entry.go b/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.2/entry.go
index ef895151c3..e5cfff1eab 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.2/entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.2/entry.go
@@ -103,54 +103,69 @@ func (v V002Entry) IndexKeys() ([]string, error) {
result = append(result, keyObj.Subjects()...)
}
- payloadKey := strings.ToLower(fmt.Sprintf("%s:%s", *v.IntotoObj.Content.PayloadHash.Algorithm, *v.IntotoObj.Content.PayloadHash.Value))
- result = append(result, payloadKey)
+ if v.IntotoObj.Content.PayloadHash != nil && v.IntotoObj.Content.PayloadHash.Algorithm != nil && v.IntotoObj.Content.PayloadHash.Value != nil {
+ payloadKey := strings.ToLower(fmt.Sprintf("%s:%s", *v.IntotoObj.Content.PayloadHash.Algorithm, *v.IntotoObj.Content.PayloadHash.Value))
+ result = append(result, payloadKey)
+ }
// since we can't deterministically calculate this server-side (due to public keys being added inline, and also canonicalization being potentially different),
// we'll just skip adding this index key
// hashkey := strings.ToLower(fmt.Sprintf("%s:%s", *v.IntotoObj.Content.Hash.Algorithm, *v.IntotoObj.Content.Hash.Value))
// result = append(result, hashkey)
- switch *v.IntotoObj.Content.Envelope.PayloadType {
- case in_toto.PayloadType:
+ if v.IntotoObj.Content.Envelope.PayloadType != nil {
+ switch *v.IntotoObj.Content.Envelope.PayloadType {
+ case in_toto.PayloadType:
- if v.IntotoObj.Content.Envelope.Payload == nil {
- log.Logger.Info("IntotoObj DSSE payload is empty")
- return result, nil
- }
- decodedPayload, err := base64.StdEncoding.DecodeString(string(v.IntotoObj.Content.Envelope.Payload))
- if err != nil {
- return result, fmt.Errorf("could not decode envelope payload: %w", err)
- }
- statement, err := parseStatement(decodedPayload)
- if err != nil {
- return result, err
- }
- for _, s := range statement.Subject {
- for alg, ds := range s.Digest {
- result = append(result, alg+":"+ds)
+ if v.IntotoObj.Content.Envelope.Payload == nil {
+ log.Logger.Info("IntotoObj DSSE payload is empty")
+ return result, nil
}
- }
- // Not all in-toto statements will contain a SLSA provenance predicate.
- // See https://github.com/in-toto/attestation/blob/main/spec/README.md#predicate
- // for other predicates.
- if predicate, err := parseSlsaPredicate(decodedPayload); err == nil {
- if predicate.Predicate.Materials != nil {
- for _, s := range predicate.Predicate.Materials {
- for alg, ds := range s.Digest {
- result = append(result, alg+":"+ds)
+ decodedPayload, err := base64.StdEncoding.DecodeString(string(v.IntotoObj.Content.Envelope.Payload))
+ if err != nil {
+ return result, fmt.Errorf("could not decode envelope payload: %w", err)
+ }
+ statement, err := parseStatement(decodedPayload)
+ if err != nil {
+ return result, err
+ }
+ for _, s := range statement.Subject {
+ for alg, ds := range s.Digest {
+ result = append(result, alg+":"+ds)
+ }
+ }
+ // Not all in-toto statements will contain a SLSA provenance predicate.
+ // See https://github.com/in-toto/attestation/blob/main/spec/README.md#predicate
+ // for other predicates.
+ if predicate, err := parseSlsaPredicate(decodedPayload); err == nil {
+ if predicate.Predicate.Materials != nil {
+ for _, s := range predicate.Predicate.Materials {
+ for alg, ds := range s.Digest {
+ result = append(result, alg+":"+ds)
+ }
}
}
}
+ default:
+ log.Logger.Infof("Unknown in_toto DSSE envelope Type: %s", *v.IntotoObj.Content.Envelope.PayloadType)
}
- default:
- log.Logger.Infof("Unknown in_toto DSSE envelope Type: %s", *v.IntotoObj.Content.Envelope.PayloadType)
+ } else {
+ log.Logger.Info("IntotoObj DSSE payloadType is nil")
}
return result, nil
}
-func parseStatement(p []byte) (*in_toto.Statement, error) {
- ps := in_toto.Statement{}
+// indexKeyExtract captures only the fields of an in-toto statement that are
+// used to derive index keys; it intentionally uses encoding/json semantics so
+// that payloads accepted today continue to parse identically.
+type indexKeyExtract struct {
+ Subject []struct {
+ Digest map[string]string `json:"digest"`
+ } `json:"subject"`
+}
+
+func parseStatement(p []byte) (*indexKeyExtract, error) {
+ ps := indexKeyExtract{}
if err := json.Unmarshal(p, &ps); err != nil {
return nil, err
}
@@ -301,10 +316,18 @@ func (v *V002Entry) Unmarshal(pe models.ProposedEntry) error {
return err
}
+ if v.IntotoObj.Content == nil || v.IntotoObj.Content.Envelope == nil {
+ return errors.New("missing content or envelope in intoto v0.0.2 entry")
+ }
+
if string(v.IntotoObj.Content.Envelope.Payload) == "" {
return nil
}
+ if v.IntotoObj.Content.Envelope.PayloadType == nil {
+ return errors.New("missing payload type in intoto v0.0.2 entry")
+ }
+
env := &dsse.Envelope{
Payload: string(v.IntotoObj.Content.Envelope.Payload),
PayloadType: *v.IntotoObj.Content.Envelope.PayloadType,
@@ -388,7 +411,7 @@ func (v *V002Entry) Canonicalize(_ context.Context) ([]byte, error) {
// AttestationKey returns the digest of the attestation that was uploaded, to be used to lookup the attestation from storage
func (v *V002Entry) AttestationKey() string {
- if v.IntotoObj.Content != nil && v.IntotoObj.Content.PayloadHash != nil {
+ if v.IntotoObj.Content != nil && v.IntotoObj.Content.PayloadHash != nil && v.IntotoObj.Content.PayloadHash.Algorithm != nil && v.IntotoObj.Content.PayloadHash.Value != nil {
return fmt.Sprintf("%s:%s", *v.IntotoObj.Content.PayloadHash.Algorithm, *v.IntotoObj.Content.PayloadHash.Value)
}
return ""
@@ -480,6 +503,9 @@ func (v V002Entry) CreateFromArtifactProperties(_ context.Context, props types.A
if len(props.PublicKeyPaths) > 0 {
for _, path := range props.PublicKeyPaths {
+ if path == nil {
+ return nil, errors.New("public key path cannot be nil")
+ }
if path.IsAbs() {
return nil, errors.New("dsse public keys cannot be fetched over HTTP(S)")
}
@@ -594,6 +620,9 @@ func (v V002Entry) Verifiers() ([]pkitypes.PublicKey, error) {
var keys []pkitypes.PublicKey
for _, s := range v.IntotoObj.Content.Envelope.Signatures {
+ if s == nil || s.PublicKey == nil {
+ return nil, errors.New("malformed or missing signature")
+ }
key, err := x509.NewPublicKey(bytes.NewReader(*s.PublicKey))
if err != nil {
return nil, err
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/rekord/rekord.go b/vendor/github.com/sigstore/rekor/pkg/types/rekord/rekord.go
index c02d05d73e..e659146e9f 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/rekord/rekord.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/rekord/rekord.go
@@ -43,7 +43,7 @@ func New() types.TypeImpl {
return &brt
}
-var VersionMap = types.NewSemVerEntryFactoryMap()
+var VersionMap = types.NewEntryFactoryMap()
func (rt BaseRekordType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImpl, error) {
if pe == nil {
@@ -51,7 +51,7 @@ func (rt BaseRekordType) UnmarshalEntry(pe models.ProposedEntry) (types.EntryImp
}
rekord, ok := pe.(*models.Rekord)
- if !ok {
+ if !ok || rekord == nil {
return nil, errors.New("cannot unmarshal non-Rekord types")
}
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/rekord/v0.0.1/entry.go b/vendor/github.com/sigstore/rekor/pkg/types/rekord/v0.0.1/entry.go
index 319dcdffff..bd1f8304a6 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/rekord/v0.0.1/entry.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/rekord/v0.0.1/entry.go
@@ -68,6 +68,18 @@ func NewEntry() types.EntryImpl {
}
func (v V001Entry) IndexKeys() ([]string, error) {
+ if v.RekordObj.Signature == nil || v.RekordObj.Signature.Format == nil || v.RekordObj.Signature.PublicKey == nil || v.RekordObj.Signature.PublicKey.Content == nil {
+ return nil, errors.New("missing signature properties")
+ }
+ if v.RekordObj.Data == nil {
+ return nil, errors.New("missing data property")
+ }
+ if v.RekordObj.Data.Hash != nil {
+ if v.RekordObj.Data.Hash.Algorithm == nil || v.RekordObj.Data.Hash.Value == nil {
+ return nil, errors.New("missing hash properties")
+ }
+ }
+
var result []string
af, err := pki.NewArtifactFactory(pki.Format(*v.RekordObj.Signature.Format))
@@ -99,7 +111,7 @@ func (v V001Entry) IndexKeys() ([]string, error) {
func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
rekord, ok := pe.(*models.Rekord)
- if !ok {
+ if !ok || rekord == nil {
return errors.New("cannot unmarshal non Rekord v0.0.1 type")
}
@@ -193,6 +205,13 @@ func DecodeEntry(input any, output *models.RekordV001Schema) error {
}
func (v *V001Entry) fetchExternalEntities(_ context.Context) (pki.PublicKey, pki.Signature, error) {
+ if v.RekordObj.Signature == nil || v.RekordObj.Signature.Format == nil {
+ return nil, nil, &types.InputValidationError{Err: errors.New("missing signature format")}
+ }
+ if v.RekordObj.Data == nil {
+ return nil, nil, &types.InputValidationError{Err: errors.New("missing data")}
+ }
+
af, err := pki.NewArtifactFactory(pki.Format(*v.RekordObj.Signature.Format))
if err != nil {
return nil, nil, err
@@ -240,6 +259,10 @@ func (v *V001Entry) fetchExternalEntities(_ context.Context) (pki.PublicKey, pki
}
func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) {
+ if v.RekordObj.Data == nil {
+ return nil, &types.InputValidationError{Err: errors.New("missing data")}
+ }
+
keyObj, sigObj, err := v.fetchExternalEntities(ctx)
if err != nil {
return nil, err
@@ -289,9 +312,12 @@ func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) {
// validate performs cross-field validation for fields in object
func (v V001Entry) validate() error {
sig := v.RekordObj.Signature
- if v.RekordObj.Signature == nil {
+ if sig == nil {
return errors.New("missing signature")
}
+ if sig.Format == nil || len(*sig.Format) == 0 {
+ return errors.New("missing signature format")
+ }
if sig.Content == nil || len(*sig.Content) == 0 {
return errors.New("'content' must be specified for signature")
}
@@ -311,8 +337,14 @@ func (v V001Entry) validate() error {
hash := data.Hash
if hash != nil {
+ if hash.Algorithm == nil || *hash.Algorithm == "" {
+ return errors.New("missing hash algorithm")
+ }
+ if hash.Value == nil || len(*hash.Value) == 0 {
+ return errors.New("missing hash value")
+ }
// Rekord v0.0.1 schema enumerates sha256; enforce length accordingly.
- if hash.Value == nil || len(*hash.Value) != crypto.SHA256.Size()*2 {
+ if len(*hash.Value) != crypto.SHA256.Size()*2 {
return errors.New("invalid value for hash")
}
if _, err := hex.DecodeString(*hash.Value); err != nil {
@@ -390,6 +422,9 @@ func (v V001Entry) CreateFromArtifactProperties(ctx context.Context, props types
if len(props.PublicKeyPaths) != 1 {
return nil, errors.New("only one public key must be provided to verify detached signature")
}
+ if props.PublicKeyPaths[0] == nil {
+ return nil, errors.New("public key path cannot be nil")
+ }
keyBytes, err := os.ReadFile(filepath.Clean(props.PublicKeyPaths[0].Path))
if err != nil {
return nil, fmt.Errorf("error reading public key file: %w", err)
@@ -416,8 +451,8 @@ func (v V001Entry) CreateFromArtifactProperties(ctx context.Context, props types
}
func (v V001Entry) Verifiers() ([]pki.PublicKey, error) {
- if v.RekordObj.Signature == nil || v.RekordObj.Signature.PublicKey == nil || v.RekordObj.Signature.PublicKey.Content == nil {
- return nil, errors.New("rekord v0.0.1 entry not initialized")
+ if v.RekordObj.Signature == nil || v.RekordObj.Signature.Format == nil || v.RekordObj.Signature.PublicKey == nil || v.RekordObj.Signature.PublicKey.Content == nil {
+ return nil, errors.New("missing signature properties")
}
var key pki.PublicKey
@@ -441,8 +476,16 @@ func (v V001Entry) Verifiers() ([]pki.PublicKey, error) {
}
func (v V001Entry) ArtifactHash() (string, error) {
- if v.RekordObj.Data == nil || v.RekordObj.Data.Hash == nil || v.RekordObj.Data.Hash.Value == nil || v.RekordObj.Data.Hash.Algorithm == nil {
- return "", errors.New("rekord v0.0.1 entry not initialized")
+ if v.RekordObj.Data == nil {
+ return "", errors.New("missing data property")
+ }
+ if v.RekordObj.Data.Hash != nil {
+ if v.RekordObj.Data.Hash.Algorithm == nil || v.RekordObj.Data.Hash.Value == nil {
+ return "", errors.New("missing hash properties")
+ }
+ }
+ if v.RekordObj.Data.Hash == nil {
+ return "", errors.New("rekord v0.0.1 entry not initialized (missing hash)")
}
return strings.ToLower(fmt.Sprintf("%s:%s", *v.RekordObj.Data.Hash.Algorithm, *v.RekordObj.Data.Hash.Value)), nil
}
diff --git a/vendor/github.com/sigstore/rekor/pkg/types/versionmap.go b/vendor/github.com/sigstore/rekor/pkg/types/versionmap.go
index d271637099..2417e3a5df 100644
--- a/vendor/github.com/sigstore/rekor/pkg/types/versionmap.go
+++ b/vendor/github.com/sigstore/rekor/pkg/types/versionmap.go
@@ -19,12 +19,11 @@ import (
"fmt"
"sync"
- "github.com/blang/semver"
"github.com/sigstore/rekor/pkg/internal/log"
)
// VersionEntryFactoryMap defines a map-like interface to find the correct implementation for a version string
-// This could be a simple map[string][EntryFactory], or something more elegant (e.g. semver)
+// This could be a simple map[string][EntryFactory], or something more elegant
type VersionEntryFactoryMap interface {
GetEntryFactory(string) (EntryFactory, error) // return the entry factory for the specified version
SetEntryFactory(string, EntryFactory) error // set the entry factory for the specified version
@@ -32,63 +31,53 @@ type VersionEntryFactoryMap interface {
SupportedVersions() []string // return a list of versions currently stored in the map
}
-// SemVerEntryFactoryMap implements a map that allows implementations to specify their supported versions using
-// semver-compliant strings
-type SemVerEntryFactoryMap struct {
+// EntryFactoryMap implements a thread-safe map of version strings to EntryFactory functions
+type EntryFactoryMap struct {
factoryMap map[string]EntryFactory
sync.RWMutex
}
-func NewSemVerEntryFactoryMap() VersionEntryFactoryMap {
- s := SemVerEntryFactoryMap{}
+func NewEntryFactoryMap() VersionEntryFactoryMap {
+ s := EntryFactoryMap{}
s.factoryMap = make(map[string]EntryFactory)
return &s
}
-func (s *SemVerEntryFactoryMap) Count() int {
+func (s *EntryFactoryMap) Count() int {
+ s.RLock()
+ defer s.RUnlock()
return len(s.factoryMap)
}
-func (s *SemVerEntryFactoryMap) GetEntryFactory(version string) (EntryFactory, error) {
+func (s *EntryFactoryMap) GetEntryFactory(version string) (EntryFactory, error) {
s.RLock()
defer s.RUnlock()
- semverToMatch, err := semver.Parse(version)
- if err != nil {
- log.Logger.Error(err)
- return nil, err
+ if ef, ok := s.factoryMap[version]; ok {
+ return ef, nil
}
- // will return first function that matches
- for k, v := range s.factoryMap {
- semverRange, err := semver.ParseRange(k)
- if err != nil {
- log.Logger.Error(err)
- return nil, err
- }
-
- if semverRange(semverToMatch) {
- return v, nil
- }
- }
return nil, fmt.Errorf("unable to locate entry for version %s", version)
}
-func (s *SemVerEntryFactoryMap) SetEntryFactory(constraint string, ef EntryFactory) error {
+func (s *EntryFactoryMap) SetEntryFactory(version string, ef EntryFactory) error {
s.Lock()
defer s.Unlock()
- if _, err := semver.ParseRange(constraint); err != nil {
+ if version == "" {
+ err := fmt.Errorf("empty version string")
log.Logger.Error(err)
return err
}
- s.factoryMap[constraint] = ef
+ s.factoryMap[version] = ef
return nil
}
-func (s *SemVerEntryFactoryMap) SupportedVersions() []string {
+func (s *EntryFactoryMap) SupportedVersions() []string {
+ s.RLock()
+ defer s.RUnlock()
var versions []string
for k := range s.factoryMap {
versions = append(versions, k)
diff --git a/vendor/github.com/sigstore/rekor/pkg/util/signed_note.go b/vendor/github.com/sigstore/rekor/pkg/util/signed_note.go
index 4c9c8f8a70..1f291ce3e2 100644
--- a/vendor/github.com/sigstore/rekor/pkg/util/signed_note.go
+++ b/vendor/github.com/sigstore/rekor/pkg/util/signed_note.go
@@ -186,6 +186,10 @@ func (s *SignedNote) UnmarshalText(data []byte) error {
sn.Signatures = append(sn.Signatures, sig)
}
+ if err := b.Err(); err != nil {
+ return fmt.Errorf("reading signed note: %w", err)
+ }
+
if len(sn.Signatures) == 0 {
return errors.New("no signatures found in input")
}
diff --git a/vendor/github.com/sigstore/rekor/pkg/verify/verify.go b/vendor/github.com/sigstore/rekor/pkg/verify/verify.go
index 5f25ed871b..05623e362c 100644
--- a/vendor/github.com/sigstore/rekor/pkg/verify/verify.go
+++ b/vendor/github.com/sigstore/rekor/pkg/verify/verify.go
@@ -48,11 +48,11 @@ func ProveConsistency(ctx context.Context, rClient *client.Rekor,
return errors.New("old root hash does not match STH hash")
}
case oldTreeSize < int64(newSTH.Size): // nolint: gosec
- consistencyParams := tlog.NewGetLogProofParamsWithContext(ctx)
+ consistencyParams := tlog.NewGetLogProofParams()
consistencyParams.FirstSize = &oldTreeSize // Root size at the old, or trusted state.
consistencyParams.LastSize = int64(newSTH.Size) // nolint: gosec // Root size at the new state to verify against.
consistencyParams.TreeID = &treeID
- consistencyProof, err := rClient.Tlog.GetLogProof(consistencyParams)
+ consistencyProof, err := rClient.Tlog.GetLogProofContext(ctx, consistencyParams)
if err != nil {
return err
}
@@ -86,8 +86,8 @@ func VerifyCurrentCheckpoint(ctx context.Context, rClient *client.Rekor, verifie
}
// Get and verify against the current STH.
- infoParams := tlog.NewGetLogInfoParamsWithContext(ctx)
- result, err := rClient.Tlog.GetLogInfo(infoParams)
+ infoParams := tlog.NewGetLogInfoParams()
+ result, err := rClient.Tlog.GetLogInfoContext(ctx, infoParams)
if err != nil {
return nil, err
}
diff --git a/vendor/golang.org/x/crypto/argon2/argon2.go b/vendor/golang.org/x/crypto/argon2/argon2.go
new file mode 100644
index 0000000000..57ab8371cb
--- /dev/null
+++ b/vendor/golang.org/x/crypto/argon2/argon2.go
@@ -0,0 +1,288 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package argon2 implements the key derivation function Argon2.
+// Argon2 was selected as the winner of the Password Hashing Competition and can
+// be used to derive cryptographic keys from passwords.
+//
+// For a detailed specification of Argon2 see [argon2-specs.pdf].
+//
+// If you aren't sure which function you need, use Argon2id (IDKey) and
+// the parameter recommendations for your scenario.
+//
+// # Argon2i
+//
+// Argon2i (implemented by Key) is the side-channel resistant version of Argon2.
+// It uses data-independent memory access, which is preferred for password
+// hashing and password-based key derivation. Argon2i requires more passes over
+// memory than Argon2id to protect from trade-off attacks. The recommended
+// parameters (taken from [RFC 9106 Section 7.3]) for non-interactive
+// operations are time=3 and to use the maximum available memory.
+//
+// # Argon2id
+//
+// Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining
+// Argon2i and Argon2d. It uses data-independent memory access for the first
+// half of the first iteration over the memory and data-dependent memory access
+// for the rest. Argon2id is side-channel resistant and provides better brute-
+// force cost savings due to time-memory tradeoffs than Argon2i. [RFC 9106
+// Section 4] recommends time=1, memory=2*1024*1024 KiB (2 GiB), and threads=4
+// as the first recommended option. If much less memory is available, it
+// recommends time=3, memory=64*1024 KiB (64 MiB), and threads=4 as the second
+// recommended option.
+//
+// [argon2-specs.pdf]: https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
+// [RFC 9106 Section 4]: https://www.rfc-editor.org/rfc/rfc9106.html#section-4
+// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
+package argon2
+
+import (
+ "encoding/binary"
+ "sync"
+
+ "golang.org/x/crypto/blake2b"
+)
+
+// The Argon2 version implemented by this package.
+const Version = 0x13
+
+const (
+ argon2d = iota
+ argon2i
+ argon2id
+)
+
+// Key derives a key from the password, salt, and cost parameters using Argon2i
+// returning a byte slice of length keyLen that can be used as cryptographic
+// key. The CPU cost and parallelism degree must be greater than zero.
+//
+// For example, you can get a derived key for e.g. AES-256 (which needs a
+// 32-byte key) by doing:
+//
+// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
+//
+// The example above uses time=3 and memory=32*1024. Argon2i generally
+// requires more passes over memory than Argon2id. If in doubt, prefer IDKey
+// and its Argon2id parameter recommendations.
+//
+// The time parameter specifies the number of passes over the memory and the
+// memory parameter specifies the size of the memory in KiB. For example
+// memory=32*1024 sets the memory cost to ~32 MB. The number of threads can be
+// adjusted to the number of available CPUs. The cost parameters should be
+// increased as memory latency and CPU parallelism increases. Remember to get a
+// good random salt.
+func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
+ return deriveKey(argon2i, password, salt, nil, nil, time, memory, threads, keyLen)
+}
+
+// IDKey derives a key from the password, salt, and cost parameters using
+// Argon2id returning a byte slice of length keyLen that can be used as
+// cryptographic key. The CPU cost and parallelism degree must be greater than
+// zero.
+//
+// For example, you can get a derived key for e.g. AES-256 (which needs a
+// 32-byte key) by doing:
+//
+// key := argon2.IDKey([]byte("some password"), salt, 1, 2*1024*1024, 4, 32)
+//
+// The example above uses the first [RFC 9106 Section 4] recommended option.
+// If much less memory is available, the second recommended option is time=3,
+// memory=64*1024 KiB (64 MiB), and threads=4.
+//
+// The time parameter specifies the number of passes over the memory and the
+// memory parameter specifies the size of the memory in KiB. For example
+// memory=2*1024*1024 sets the memory cost to ~2 GiB. The number of threads can
+// be adjusted to the numbers of available CPUs. The cost parameters should be
+// increased as memory latency and CPU parallelism increases. Remember to get a
+// good random salt.
+//
+// [RFC 9106 Section 4]: https://www.rfc-editor.org/rfc/rfc9106.html#section-4
+func IDKey(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
+ return deriveKey(argon2id, password, salt, nil, nil, time, memory, threads, keyLen)
+}
+
+func deriveKey(mode int, password, salt, secret, data []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
+ if time < 1 {
+ panic("argon2: number of rounds too small")
+ }
+ if threads < 1 {
+ panic("argon2: parallelism degree too low")
+ }
+ h0 := initHash(password, salt, secret, data, time, memory, uint32(threads), keyLen, mode)
+
+ memory = memory / (syncPoints * uint32(threads)) * (syncPoints * uint32(threads))
+ if memory < 2*syncPoints*uint32(threads) {
+ memory = 2 * syncPoints * uint32(threads)
+ }
+ B := initBlocks(&h0, memory, uint32(threads))
+ processBlocks(B, time, memory, uint32(threads), mode)
+ return extractKey(B, memory, uint32(threads), keyLen)
+}
+
+const (
+ blockLength = 128
+ syncPoints = 4
+)
+
+type block [blockLength]uint64
+
+func initHash(password, salt, key, data []byte, time, memory, threads, keyLen uint32, mode int) [blake2b.Size + 8]byte {
+ var (
+ h0 [blake2b.Size + 8]byte
+ params [24]byte
+ tmp [4]byte
+ )
+
+ b2, _ := blake2b.New512(nil)
+ binary.LittleEndian.PutUint32(params[0:4], threads)
+ binary.LittleEndian.PutUint32(params[4:8], keyLen)
+ binary.LittleEndian.PutUint32(params[8:12], memory)
+ binary.LittleEndian.PutUint32(params[12:16], time)
+ binary.LittleEndian.PutUint32(params[16:20], uint32(Version))
+ binary.LittleEndian.PutUint32(params[20:24], uint32(mode))
+ b2.Write(params[:])
+ binary.LittleEndian.PutUint32(tmp[:], uint32(len(password)))
+ b2.Write(tmp[:])
+ b2.Write(password)
+ binary.LittleEndian.PutUint32(tmp[:], uint32(len(salt)))
+ b2.Write(tmp[:])
+ b2.Write(salt)
+ binary.LittleEndian.PutUint32(tmp[:], uint32(len(key)))
+ b2.Write(tmp[:])
+ b2.Write(key)
+ binary.LittleEndian.PutUint32(tmp[:], uint32(len(data)))
+ b2.Write(tmp[:])
+ b2.Write(data)
+ b2.Sum(h0[:0])
+ return h0
+}
+
+func initBlocks(h0 *[blake2b.Size + 8]byte, memory, threads uint32) []block {
+ var block0 [1024]byte
+ B := make([]block, memory)
+ for lane := uint32(0); lane < threads; lane++ {
+ j := lane * (memory / threads)
+ binary.LittleEndian.PutUint32(h0[blake2b.Size+4:], lane)
+
+ binary.LittleEndian.PutUint32(h0[blake2b.Size:], 0)
+ blake2bHash(block0[:], h0[:])
+ for i := range B[j+0] {
+ B[j+0][i] = binary.LittleEndian.Uint64(block0[i*8:])
+ }
+
+ binary.LittleEndian.PutUint32(h0[blake2b.Size:], 1)
+ blake2bHash(block0[:], h0[:])
+ for i := range B[j+1] {
+ B[j+1][i] = binary.LittleEndian.Uint64(block0[i*8:])
+ }
+ }
+ return B
+}
+
+func processBlocks(B []block, time, memory, threads uint32, mode int) {
+ lanes := memory / threads
+ segments := lanes / syncPoints
+
+ processSegment := func(n, slice, lane uint32, wg *sync.WaitGroup) {
+ var addresses, in, zero block
+ if mode == argon2i || (mode == argon2id && n == 0 && slice < syncPoints/2) {
+ in[0] = uint64(n)
+ in[1] = uint64(lane)
+ in[2] = uint64(slice)
+ in[3] = uint64(memory)
+ in[4] = uint64(time)
+ in[5] = uint64(mode)
+ }
+
+ index := uint32(0)
+ if n == 0 && slice == 0 {
+ index = 2 // we have already generated the first two blocks
+ if mode == argon2i || mode == argon2id {
+ in[6]++
+ processBlock(&addresses, &in, &zero)
+ processBlock(&addresses, &addresses, &zero)
+ }
+ }
+
+ offset := lane*lanes + slice*segments + index
+ var random uint64
+ for index < segments {
+ prev := offset - 1
+ if index == 0 && slice == 0 {
+ prev += lanes // last block in lane
+ }
+ if mode == argon2i || (mode == argon2id && n == 0 && slice < syncPoints/2) {
+ if index%blockLength == 0 {
+ in[6]++
+ processBlock(&addresses, &in, &zero)
+ processBlock(&addresses, &addresses, &zero)
+ }
+ random = addresses[index%blockLength]
+ } else {
+ random = B[prev][0]
+ }
+ newOffset := indexAlpha(random, lanes, segments, threads, n, slice, lane, index)
+ processBlockXOR(&B[offset], &B[prev], &B[newOffset])
+ index, offset = index+1, offset+1
+ }
+ wg.Done()
+ }
+
+ for n := uint32(0); n < time; n++ {
+ for slice := uint32(0); slice < syncPoints; slice++ {
+ var wg sync.WaitGroup
+ for lane := uint32(0); lane < threads; lane++ {
+ wg.Add(1)
+ go processSegment(n, slice, lane, &wg)
+ }
+ wg.Wait()
+ }
+ }
+
+}
+
+func extractKey(B []block, memory, threads, keyLen uint32) []byte {
+ lanes := memory / threads
+ for lane := uint32(0); lane < threads-1; lane++ {
+ for i, v := range B[(lane*lanes)+lanes-1] {
+ B[memory-1][i] ^= v
+ }
+ }
+
+ var block [1024]byte
+ for i, v := range B[memory-1] {
+ binary.LittleEndian.PutUint64(block[i*8:], v)
+ }
+ key := make([]byte, keyLen)
+ blake2bHash(key, block[:])
+ return key
+}
+
+func indexAlpha(rand uint64, lanes, segments, threads, n, slice, lane, index uint32) uint32 {
+ refLane := uint32(rand>>32) % threads
+ if n == 0 && slice == 0 {
+ refLane = lane
+ }
+ m, s := 3*segments, ((slice+1)%syncPoints)*segments
+ if lane == refLane {
+ m += index
+ }
+ if n == 0 {
+ m, s = slice*segments, 0
+ if slice == 0 || lane == refLane {
+ m += index
+ }
+ }
+ if index == 0 || lane == refLane {
+ m--
+ }
+ return phi(rand, uint64(m), uint64(s), refLane, lanes)
+}
+
+func phi(rand, m, s uint64, lane, lanes uint32) uint32 {
+ p := rand & 0xFFFFFFFF
+ p = (p * p) >> 32
+ p = (p * m) >> 32
+ return lane*lanes + uint32((s+m-(p+1))%uint64(lanes))
+}
diff --git a/vendor/golang.org/x/crypto/argon2/blake2b.go b/vendor/golang.org/x/crypto/argon2/blake2b.go
new file mode 100644
index 0000000000..10f46948dc
--- /dev/null
+++ b/vendor/golang.org/x/crypto/argon2/blake2b.go
@@ -0,0 +1,53 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package argon2
+
+import (
+ "encoding/binary"
+ "hash"
+
+ "golang.org/x/crypto/blake2b"
+)
+
+// blake2bHash computes an arbitrary long hash value of in
+// and writes the hash to out.
+func blake2bHash(out []byte, in []byte) {
+ var b2 hash.Hash
+ if n := len(out); n < blake2b.Size {
+ b2, _ = blake2b.New(n, nil)
+ } else {
+ b2, _ = blake2b.New512(nil)
+ }
+
+ var buffer [blake2b.Size]byte
+ binary.LittleEndian.PutUint32(buffer[:4], uint32(len(out)))
+ b2.Write(buffer[:4])
+ b2.Write(in)
+
+ if len(out) <= blake2b.Size {
+ b2.Sum(out[:0])
+ return
+ }
+
+ outLen := len(out)
+ b2.Sum(buffer[:0])
+ b2.Reset()
+ copy(out, buffer[:32])
+ out = out[32:]
+ for len(out) > blake2b.Size {
+ b2.Write(buffer[:])
+ b2.Sum(buffer[:0])
+ copy(out, buffer[:32])
+ out = out[32:]
+ b2.Reset()
+ }
+
+ if outLen%blake2b.Size > 0 { // outLen > 64
+ r := ((outLen + 31) / 32) - 2 // ⌈τ /32⌉-2
+ b2, _ = blake2b.New(outLen-32*r, nil)
+ }
+ b2.Write(buffer[:])
+ b2.Sum(out[:0])
+}
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_amd64.go b/vendor/golang.org/x/crypto/argon2/blamka_amd64.go
new file mode 100644
index 0000000000..063e7784f8
--- /dev/null
+++ b/vendor/golang.org/x/crypto/argon2/blamka_amd64.go
@@ -0,0 +1,60 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build amd64 && gc && !purego
+
+package argon2
+
+import "golang.org/x/sys/cpu"
+
+func init() {
+ useSSE4 = cpu.X86.HasSSE41
+}
+
+//go:noescape
+func mixBlocksSSE2(out, a, b, c *block)
+
+//go:noescape
+func xorBlocksSSE2(out, a, b, c *block)
+
+//go:noescape
+func blamkaSSE4(b *block)
+
+func processBlockSSE(out, in1, in2 *block, xor bool) {
+ var t block
+ mixBlocksSSE2(&t, in1, in2, &t)
+ if useSSE4 {
+ blamkaSSE4(&t)
+ } else {
+ for i := 0; i < blockLength; i += 16 {
+ blamkaGeneric(
+ &t[i+0], &t[i+1], &t[i+2], &t[i+3],
+ &t[i+4], &t[i+5], &t[i+6], &t[i+7],
+ &t[i+8], &t[i+9], &t[i+10], &t[i+11],
+ &t[i+12], &t[i+13], &t[i+14], &t[i+15],
+ )
+ }
+ for i := 0; i < blockLength/8; i += 2 {
+ blamkaGeneric(
+ &t[i], &t[i+1], &t[16+i], &t[16+i+1],
+ &t[32+i], &t[32+i+1], &t[48+i], &t[48+i+1],
+ &t[64+i], &t[64+i+1], &t[80+i], &t[80+i+1],
+ &t[96+i], &t[96+i+1], &t[112+i], &t[112+i+1],
+ )
+ }
+ }
+ if xor {
+ xorBlocksSSE2(out, in1, in2, &t)
+ } else {
+ mixBlocksSSE2(out, in1, in2, &t)
+ }
+}
+
+func processBlock(out, in1, in2 *block) {
+ processBlockSSE(out, in1, in2, false)
+}
+
+func processBlockXOR(out, in1, in2 *block) {
+ processBlockSSE(out, in1, in2, true)
+}
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_amd64.s b/vendor/golang.org/x/crypto/argon2/blamka_amd64.s
new file mode 100644
index 0000000000..c3895478ed
--- /dev/null
+++ b/vendor/golang.org/x/crypto/argon2/blamka_amd64.s
@@ -0,0 +1,2791 @@
+// Code generated by command: go run blamka_amd64.go -out ../blamka_amd64.s -pkg argon2. DO NOT EDIT.
+
+//go:build amd64 && gc && !purego
+
+#include "textflag.h"
+
+// func blamkaSSE4(b *block)
+// Requires: SSE2, SSSE3
+TEXT ·blamkaSSE4(SB), NOSPLIT, $0-8
+ MOVQ b+0(FP), AX
+ MOVOU ·c40<>+0(SB), X10
+ MOVOU ·c48<>+0(SB), X11
+ MOVOU (AX), X0
+ MOVOU 16(AX), X1
+ MOVOU 32(AX), X2
+ MOVOU 48(AX), X3
+ MOVOU 64(AX), X4
+ MOVOU 80(AX), X5
+ MOVOU 96(AX), X6
+ MOVOU 112(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, (AX)
+ MOVOU X1, 16(AX)
+ MOVOU X2, 32(AX)
+ MOVOU X3, 48(AX)
+ MOVOU X4, 64(AX)
+ MOVOU X5, 80(AX)
+ MOVOU X6, 96(AX)
+ MOVOU X7, 112(AX)
+ MOVOU 128(AX), X0
+ MOVOU 144(AX), X1
+ MOVOU 160(AX), X2
+ MOVOU 176(AX), X3
+ MOVOU 192(AX), X4
+ MOVOU 208(AX), X5
+ MOVOU 224(AX), X6
+ MOVOU 240(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 128(AX)
+ MOVOU X1, 144(AX)
+ MOVOU X2, 160(AX)
+ MOVOU X3, 176(AX)
+ MOVOU X4, 192(AX)
+ MOVOU X5, 208(AX)
+ MOVOU X6, 224(AX)
+ MOVOU X7, 240(AX)
+ MOVOU 256(AX), X0
+ MOVOU 272(AX), X1
+ MOVOU 288(AX), X2
+ MOVOU 304(AX), X3
+ MOVOU 320(AX), X4
+ MOVOU 336(AX), X5
+ MOVOU 352(AX), X6
+ MOVOU 368(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 256(AX)
+ MOVOU X1, 272(AX)
+ MOVOU X2, 288(AX)
+ MOVOU X3, 304(AX)
+ MOVOU X4, 320(AX)
+ MOVOU X5, 336(AX)
+ MOVOU X6, 352(AX)
+ MOVOU X7, 368(AX)
+ MOVOU 384(AX), X0
+ MOVOU 400(AX), X1
+ MOVOU 416(AX), X2
+ MOVOU 432(AX), X3
+ MOVOU 448(AX), X4
+ MOVOU 464(AX), X5
+ MOVOU 480(AX), X6
+ MOVOU 496(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 384(AX)
+ MOVOU X1, 400(AX)
+ MOVOU X2, 416(AX)
+ MOVOU X3, 432(AX)
+ MOVOU X4, 448(AX)
+ MOVOU X5, 464(AX)
+ MOVOU X6, 480(AX)
+ MOVOU X7, 496(AX)
+ MOVOU 512(AX), X0
+ MOVOU 528(AX), X1
+ MOVOU 544(AX), X2
+ MOVOU 560(AX), X3
+ MOVOU 576(AX), X4
+ MOVOU 592(AX), X5
+ MOVOU 608(AX), X6
+ MOVOU 624(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 512(AX)
+ MOVOU X1, 528(AX)
+ MOVOU X2, 544(AX)
+ MOVOU X3, 560(AX)
+ MOVOU X4, 576(AX)
+ MOVOU X5, 592(AX)
+ MOVOU X6, 608(AX)
+ MOVOU X7, 624(AX)
+ MOVOU 640(AX), X0
+ MOVOU 656(AX), X1
+ MOVOU 672(AX), X2
+ MOVOU 688(AX), X3
+ MOVOU 704(AX), X4
+ MOVOU 720(AX), X5
+ MOVOU 736(AX), X6
+ MOVOU 752(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 640(AX)
+ MOVOU X1, 656(AX)
+ MOVOU X2, 672(AX)
+ MOVOU X3, 688(AX)
+ MOVOU X4, 704(AX)
+ MOVOU X5, 720(AX)
+ MOVOU X6, 736(AX)
+ MOVOU X7, 752(AX)
+ MOVOU 768(AX), X0
+ MOVOU 784(AX), X1
+ MOVOU 800(AX), X2
+ MOVOU 816(AX), X3
+ MOVOU 832(AX), X4
+ MOVOU 848(AX), X5
+ MOVOU 864(AX), X6
+ MOVOU 880(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 768(AX)
+ MOVOU X1, 784(AX)
+ MOVOU X2, 800(AX)
+ MOVOU X3, 816(AX)
+ MOVOU X4, 832(AX)
+ MOVOU X5, 848(AX)
+ MOVOU X6, 864(AX)
+ MOVOU X7, 880(AX)
+ MOVOU 896(AX), X0
+ MOVOU 912(AX), X1
+ MOVOU 928(AX), X2
+ MOVOU 944(AX), X3
+ MOVOU 960(AX), X4
+ MOVOU 976(AX), X5
+ MOVOU 992(AX), X6
+ MOVOU 1008(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 896(AX)
+ MOVOU X1, 912(AX)
+ MOVOU X2, 928(AX)
+ MOVOU X3, 944(AX)
+ MOVOU X4, 960(AX)
+ MOVOU X5, 976(AX)
+ MOVOU X6, 992(AX)
+ MOVOU X7, 1008(AX)
+ MOVOU (AX), X0
+ MOVOU 128(AX), X1
+ MOVOU 256(AX), X2
+ MOVOU 384(AX), X3
+ MOVOU 512(AX), X4
+ MOVOU 640(AX), X5
+ MOVOU 768(AX), X6
+ MOVOU 896(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, (AX)
+ MOVOU X1, 128(AX)
+ MOVOU X2, 256(AX)
+ MOVOU X3, 384(AX)
+ MOVOU X4, 512(AX)
+ MOVOU X5, 640(AX)
+ MOVOU X6, 768(AX)
+ MOVOU X7, 896(AX)
+ MOVOU 16(AX), X0
+ MOVOU 144(AX), X1
+ MOVOU 272(AX), X2
+ MOVOU 400(AX), X3
+ MOVOU 528(AX), X4
+ MOVOU 656(AX), X5
+ MOVOU 784(AX), X6
+ MOVOU 912(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 16(AX)
+ MOVOU X1, 144(AX)
+ MOVOU X2, 272(AX)
+ MOVOU X3, 400(AX)
+ MOVOU X4, 528(AX)
+ MOVOU X5, 656(AX)
+ MOVOU X6, 784(AX)
+ MOVOU X7, 912(AX)
+ MOVOU 32(AX), X0
+ MOVOU 160(AX), X1
+ MOVOU 288(AX), X2
+ MOVOU 416(AX), X3
+ MOVOU 544(AX), X4
+ MOVOU 672(AX), X5
+ MOVOU 800(AX), X6
+ MOVOU 928(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 32(AX)
+ MOVOU X1, 160(AX)
+ MOVOU X2, 288(AX)
+ MOVOU X3, 416(AX)
+ MOVOU X4, 544(AX)
+ MOVOU X5, 672(AX)
+ MOVOU X6, 800(AX)
+ MOVOU X7, 928(AX)
+ MOVOU 48(AX), X0
+ MOVOU 176(AX), X1
+ MOVOU 304(AX), X2
+ MOVOU 432(AX), X3
+ MOVOU 560(AX), X4
+ MOVOU 688(AX), X5
+ MOVOU 816(AX), X6
+ MOVOU 944(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 48(AX)
+ MOVOU X1, 176(AX)
+ MOVOU X2, 304(AX)
+ MOVOU X3, 432(AX)
+ MOVOU X4, 560(AX)
+ MOVOU X5, 688(AX)
+ MOVOU X6, 816(AX)
+ MOVOU X7, 944(AX)
+ MOVOU 64(AX), X0
+ MOVOU 192(AX), X1
+ MOVOU 320(AX), X2
+ MOVOU 448(AX), X3
+ MOVOU 576(AX), X4
+ MOVOU 704(AX), X5
+ MOVOU 832(AX), X6
+ MOVOU 960(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 64(AX)
+ MOVOU X1, 192(AX)
+ MOVOU X2, 320(AX)
+ MOVOU X3, 448(AX)
+ MOVOU X4, 576(AX)
+ MOVOU X5, 704(AX)
+ MOVOU X6, 832(AX)
+ MOVOU X7, 960(AX)
+ MOVOU 80(AX), X0
+ MOVOU 208(AX), X1
+ MOVOU 336(AX), X2
+ MOVOU 464(AX), X3
+ MOVOU 592(AX), X4
+ MOVOU 720(AX), X5
+ MOVOU 848(AX), X6
+ MOVOU 976(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 80(AX)
+ MOVOU X1, 208(AX)
+ MOVOU X2, 336(AX)
+ MOVOU X3, 464(AX)
+ MOVOU X4, 592(AX)
+ MOVOU X5, 720(AX)
+ MOVOU X6, 848(AX)
+ MOVOU X7, 976(AX)
+ MOVOU 96(AX), X0
+ MOVOU 224(AX), X1
+ MOVOU 352(AX), X2
+ MOVOU 480(AX), X3
+ MOVOU 608(AX), X4
+ MOVOU 736(AX), X5
+ MOVOU 864(AX), X6
+ MOVOU 992(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 96(AX)
+ MOVOU X1, 224(AX)
+ MOVOU X2, 352(AX)
+ MOVOU X3, 480(AX)
+ MOVOU X4, 608(AX)
+ MOVOU X5, 736(AX)
+ MOVOU X6, 864(AX)
+ MOVOU X7, 992(AX)
+ MOVOU 112(AX), X0
+ MOVOU 240(AX), X1
+ MOVOU 368(AX), X2
+ MOVOU 496(AX), X3
+ MOVOU 624(AX), X4
+ MOVOU 752(AX), X5
+ MOVOU 880(AX), X6
+ MOVOU 1008(AX), X7
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X6, X8
+ PUNPCKLQDQ X6, X9
+ PUNPCKHQDQ X7, X6
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X7, X9
+ MOVO X8, X7
+ MOVO X2, X8
+ PUNPCKHQDQ X9, X7
+ PUNPCKLQDQ X3, X9
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X3
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFD $0xb1, X6, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ PSHUFB X10, X2
+ MOVO X0, X8
+ PMULULQ X2, X8
+ PADDQ X2, X0
+ PADDQ X8, X0
+ PADDQ X8, X0
+ PXOR X0, X6
+ PSHUFB X11, X6
+ MOVO X4, X8
+ PMULULQ X6, X8
+ PADDQ X6, X4
+ PADDQ X8, X4
+ PADDQ X8, X4
+ PXOR X4, X2
+ MOVO X2, X8
+ PADDQ X2, X8
+ PSRLQ $0x3f, X2
+ PXOR X8, X2
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFD $0xb1, X7, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ PSHUFB X10, X3
+ MOVO X1, X8
+ PMULULQ X3, X8
+ PADDQ X3, X1
+ PADDQ X8, X1
+ PADDQ X8, X1
+ PXOR X1, X7
+ PSHUFB X11, X7
+ MOVO X5, X8
+ PMULULQ X7, X8
+ PADDQ X7, X5
+ PADDQ X8, X5
+ PADDQ X8, X5
+ PXOR X5, X3
+ MOVO X3, X8
+ PADDQ X3, X8
+ PSRLQ $0x3f, X3
+ PXOR X8, X3
+ MOVO X4, X8
+ MOVO X5, X4
+ MOVO X8, X5
+ MOVO X2, X8
+ PUNPCKLQDQ X2, X9
+ PUNPCKHQDQ X3, X2
+ PUNPCKHQDQ X9, X2
+ PUNPCKLQDQ X3, X9
+ MOVO X8, X3
+ MOVO X6, X8
+ PUNPCKHQDQ X9, X3
+ PUNPCKLQDQ X7, X9
+ PUNPCKHQDQ X9, X6
+ PUNPCKLQDQ X8, X9
+ PUNPCKHQDQ X9, X7
+ MOVOU X0, 112(AX)
+ MOVOU X1, 240(AX)
+ MOVOU X2, 368(AX)
+ MOVOU X3, 496(AX)
+ MOVOU X4, 624(AX)
+ MOVOU X5, 752(AX)
+ MOVOU X6, 880(AX)
+ MOVOU X7, 1008(AX)
+ RET
+
+DATA ·c40<>+0(SB)/8, $0x0201000706050403
+DATA ·c40<>+8(SB)/8, $0x0a09080f0e0d0c0b
+GLOBL ·c40<>(SB), RODATA|NOPTR, $16
+
+DATA ·c48<>+0(SB)/8, $0x0100070605040302
+DATA ·c48<>+8(SB)/8, $0x09080f0e0d0c0b0a
+GLOBL ·c48<>(SB), RODATA|NOPTR, $16
+
+// func mixBlocksSSE2(out *block, a *block, b *block, c *block)
+// Requires: SSE2
+TEXT ·mixBlocksSSE2(SB), NOSPLIT, $0-32
+ MOVQ out+0(FP), DX
+ MOVQ a+8(FP), AX
+ MOVQ b+16(FP), BX
+ MOVQ c+24(FP), CX
+ MOVQ $0x00000080, DI
+
+loop:
+ MOVOU (AX), X0
+ MOVOU (BX), X1
+ MOVOU (CX), X2
+ PXOR X1, X0
+ PXOR X2, X0
+ MOVOU X0, (DX)
+ ADDQ $0x10, AX
+ ADDQ $0x10, BX
+ ADDQ $0x10, CX
+ ADDQ $0x10, DX
+ SUBQ $0x02, DI
+ JA loop
+ RET
+
+// func xorBlocksSSE2(out *block, a *block, b *block, c *block)
+// Requires: SSE2
+TEXT ·xorBlocksSSE2(SB), NOSPLIT, $0-32
+ MOVQ out+0(FP), DX
+ MOVQ a+8(FP), AX
+ MOVQ b+16(FP), BX
+ MOVQ c+24(FP), CX
+ MOVQ $0x00000080, DI
+
+loop:
+ MOVOU (AX), X0
+ MOVOU (BX), X1
+ MOVOU (CX), X2
+ MOVOU (DX), X3
+ PXOR X1, X0
+ PXOR X2, X0
+ PXOR X3, X0
+ MOVOU X0, (DX)
+ ADDQ $0x10, AX
+ ADDQ $0x10, BX
+ ADDQ $0x10, CX
+ ADDQ $0x10, DX
+ SUBQ $0x02, DI
+ JA loop
+ RET
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_generic.go b/vendor/golang.org/x/crypto/argon2/blamka_generic.go
new file mode 100644
index 0000000000..a481b2243f
--- /dev/null
+++ b/vendor/golang.org/x/crypto/argon2/blamka_generic.go
@@ -0,0 +1,163 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package argon2
+
+var useSSE4 bool
+
+func processBlockGeneric(out, in1, in2 *block, xor bool) {
+ var t block
+ for i := range t {
+ t[i] = in1[i] ^ in2[i]
+ }
+ for i := 0; i < blockLength; i += 16 {
+ blamkaGeneric(
+ &t[i+0], &t[i+1], &t[i+2], &t[i+3],
+ &t[i+4], &t[i+5], &t[i+6], &t[i+7],
+ &t[i+8], &t[i+9], &t[i+10], &t[i+11],
+ &t[i+12], &t[i+13], &t[i+14], &t[i+15],
+ )
+ }
+ for i := 0; i < blockLength/8; i += 2 {
+ blamkaGeneric(
+ &t[i], &t[i+1], &t[16+i], &t[16+i+1],
+ &t[32+i], &t[32+i+1], &t[48+i], &t[48+i+1],
+ &t[64+i], &t[64+i+1], &t[80+i], &t[80+i+1],
+ &t[96+i], &t[96+i+1], &t[112+i], &t[112+i+1],
+ )
+ }
+ if xor {
+ for i := range t {
+ out[i] ^= in1[i] ^ in2[i] ^ t[i]
+ }
+ } else {
+ for i := range t {
+ out[i] = in1[i] ^ in2[i] ^ t[i]
+ }
+ }
+}
+
+func blamkaGeneric(t00, t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15 *uint64) {
+ v00, v01, v02, v03 := *t00, *t01, *t02, *t03
+ v04, v05, v06, v07 := *t04, *t05, *t06, *t07
+ v08, v09, v10, v11 := *t08, *t09, *t10, *t11
+ v12, v13, v14, v15 := *t12, *t13, *t14, *t15
+
+ v00 += v04 + 2*uint64(uint32(v00))*uint64(uint32(v04))
+ v12 ^= v00
+ v12 = v12>>32 | v12<<32
+ v08 += v12 + 2*uint64(uint32(v08))*uint64(uint32(v12))
+ v04 ^= v08
+ v04 = v04>>24 | v04<<40
+
+ v00 += v04 + 2*uint64(uint32(v00))*uint64(uint32(v04))
+ v12 ^= v00
+ v12 = v12>>16 | v12<<48
+ v08 += v12 + 2*uint64(uint32(v08))*uint64(uint32(v12))
+ v04 ^= v08
+ v04 = v04>>63 | v04<<1
+
+ v01 += v05 + 2*uint64(uint32(v01))*uint64(uint32(v05))
+ v13 ^= v01
+ v13 = v13>>32 | v13<<32
+ v09 += v13 + 2*uint64(uint32(v09))*uint64(uint32(v13))
+ v05 ^= v09
+ v05 = v05>>24 | v05<<40
+
+ v01 += v05 + 2*uint64(uint32(v01))*uint64(uint32(v05))
+ v13 ^= v01
+ v13 = v13>>16 | v13<<48
+ v09 += v13 + 2*uint64(uint32(v09))*uint64(uint32(v13))
+ v05 ^= v09
+ v05 = v05>>63 | v05<<1
+
+ v02 += v06 + 2*uint64(uint32(v02))*uint64(uint32(v06))
+ v14 ^= v02
+ v14 = v14>>32 | v14<<32
+ v10 += v14 + 2*uint64(uint32(v10))*uint64(uint32(v14))
+ v06 ^= v10
+ v06 = v06>>24 | v06<<40
+
+ v02 += v06 + 2*uint64(uint32(v02))*uint64(uint32(v06))
+ v14 ^= v02
+ v14 = v14>>16 | v14<<48
+ v10 += v14 + 2*uint64(uint32(v10))*uint64(uint32(v14))
+ v06 ^= v10
+ v06 = v06>>63 | v06<<1
+
+ v03 += v07 + 2*uint64(uint32(v03))*uint64(uint32(v07))
+ v15 ^= v03
+ v15 = v15>>32 | v15<<32
+ v11 += v15 + 2*uint64(uint32(v11))*uint64(uint32(v15))
+ v07 ^= v11
+ v07 = v07>>24 | v07<<40
+
+ v03 += v07 + 2*uint64(uint32(v03))*uint64(uint32(v07))
+ v15 ^= v03
+ v15 = v15>>16 | v15<<48
+ v11 += v15 + 2*uint64(uint32(v11))*uint64(uint32(v15))
+ v07 ^= v11
+ v07 = v07>>63 | v07<<1
+
+ v00 += v05 + 2*uint64(uint32(v00))*uint64(uint32(v05))
+ v15 ^= v00
+ v15 = v15>>32 | v15<<32
+ v10 += v15 + 2*uint64(uint32(v10))*uint64(uint32(v15))
+ v05 ^= v10
+ v05 = v05>>24 | v05<<40
+
+ v00 += v05 + 2*uint64(uint32(v00))*uint64(uint32(v05))
+ v15 ^= v00
+ v15 = v15>>16 | v15<<48
+ v10 += v15 + 2*uint64(uint32(v10))*uint64(uint32(v15))
+ v05 ^= v10
+ v05 = v05>>63 | v05<<1
+
+ v01 += v06 + 2*uint64(uint32(v01))*uint64(uint32(v06))
+ v12 ^= v01
+ v12 = v12>>32 | v12<<32
+ v11 += v12 + 2*uint64(uint32(v11))*uint64(uint32(v12))
+ v06 ^= v11
+ v06 = v06>>24 | v06<<40
+
+ v01 += v06 + 2*uint64(uint32(v01))*uint64(uint32(v06))
+ v12 ^= v01
+ v12 = v12>>16 | v12<<48
+ v11 += v12 + 2*uint64(uint32(v11))*uint64(uint32(v12))
+ v06 ^= v11
+ v06 = v06>>63 | v06<<1
+
+ v02 += v07 + 2*uint64(uint32(v02))*uint64(uint32(v07))
+ v13 ^= v02
+ v13 = v13>>32 | v13<<32
+ v08 += v13 + 2*uint64(uint32(v08))*uint64(uint32(v13))
+ v07 ^= v08
+ v07 = v07>>24 | v07<<40
+
+ v02 += v07 + 2*uint64(uint32(v02))*uint64(uint32(v07))
+ v13 ^= v02
+ v13 = v13>>16 | v13<<48
+ v08 += v13 + 2*uint64(uint32(v08))*uint64(uint32(v13))
+ v07 ^= v08
+ v07 = v07>>63 | v07<<1
+
+ v03 += v04 + 2*uint64(uint32(v03))*uint64(uint32(v04))
+ v14 ^= v03
+ v14 = v14>>32 | v14<<32
+ v09 += v14 + 2*uint64(uint32(v09))*uint64(uint32(v14))
+ v04 ^= v09
+ v04 = v04>>24 | v04<<40
+
+ v03 += v04 + 2*uint64(uint32(v03))*uint64(uint32(v04))
+ v14 ^= v03
+ v14 = v14>>16 | v14<<48
+ v09 += v14 + 2*uint64(uint32(v09))*uint64(uint32(v14))
+ v04 ^= v09
+ v04 = v04>>63 | v04<<1
+
+ *t00, *t01, *t02, *t03 = v00, v01, v02, v03
+ *t04, *t05, *t06, *t07 = v04, v05, v06, v07
+ *t08, *t09, *t10, *t11 = v08, v09, v10, v11
+ *t12, *t13, *t14, *t15 = v12, v13, v14, v15
+}
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_ref.go b/vendor/golang.org/x/crypto/argon2/blamka_ref.go
new file mode 100644
index 0000000000..16d58c650e
--- /dev/null
+++ b/vendor/golang.org/x/crypto/argon2/blamka_ref.go
@@ -0,0 +1,15 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !amd64 || purego || !gc
+
+package argon2
+
+func processBlock(out, in1, in2 *block) {
+ processBlockGeneric(out, in1, in2, false)
+}
+
+func processBlockXOR(out, in1, in2 *block) {
+ processBlockGeneric(out, in1, in2, true)
+}
diff --git a/vendor/golang.org/x/crypto/sha3/hashes.go b/vendor/golang.org/x/crypto/sha3/hashes.go
new file mode 100644
index 0000000000..a51269d91a
--- /dev/null
+++ b/vendor/golang.org/x/crypto/sha3/hashes.go
@@ -0,0 +1,95 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package sha3 implements the SHA-3 hash algorithms and the SHAKE extendable
+// output functions defined in FIPS 202.
+//
+// Most of this package is a wrapper around the crypto/sha3 package in the
+// standard library. The only exception is the legacy Keccak hash functions.
+package sha3
+
+import (
+ "crypto/sha3"
+ "hash"
+)
+
+// New224 creates a new SHA3-224 hash.
+// Its generic security strength is 224 bits against preimage attacks,
+// and 112 bits against collision attacks.
+//
+// It is a wrapper for the [sha3.New224] function in the standard library.
+//
+//go:fix inline
+func New224() hash.Hash {
+ return sha3.New224()
+}
+
+// New256 creates a new SHA3-256 hash.
+// Its generic security strength is 256 bits against preimage attacks,
+// and 128 bits against collision attacks.
+//
+// It is a wrapper for the [sha3.New256] function in the standard library.
+//
+//go:fix inline
+func New256() hash.Hash {
+ return sha3.New256()
+}
+
+// New384 creates a new SHA3-384 hash.
+// Its generic security strength is 384 bits against preimage attacks,
+// and 192 bits against collision attacks.
+//
+// It is a wrapper for the [sha3.New384] function in the standard library.
+//
+//go:fix inline
+func New384() hash.Hash {
+ return sha3.New384()
+}
+
+// New512 creates a new SHA3-512 hash.
+// Its generic security strength is 512 bits against preimage attacks,
+// and 256 bits against collision attacks.
+//
+// It is a wrapper for the [sha3.New512] function in the standard library.
+//
+//go:fix inline
+func New512() hash.Hash {
+ return sha3.New512()
+}
+
+// Sum224 returns the SHA3-224 digest of the data.
+//
+// It is a wrapper for the [sha3.Sum224] function in the standard library.
+//
+//go:fix inline
+func Sum224(data []byte) [28]byte {
+ return sha3.Sum224(data)
+}
+
+// Sum256 returns the SHA3-256 digest of the data.
+//
+// It is a wrapper for the [sha3.Sum256] function in the standard library.
+//
+//go:fix inline
+func Sum256(data []byte) [32]byte {
+ return sha3.Sum256(data)
+}
+
+// Sum384 returns the SHA3-384 digest of the data.
+//
+// It is a wrapper for the [sha3.Sum384] function in the standard library.
+//
+//go:fix inline
+func Sum384(data []byte) [48]byte {
+ return sha3.Sum384(data)
+}
+
+// Sum512 returns the SHA3-512 digest of the data.
+//
+// It is a wrapper for the [sha3.Sum512] function in the standard library.
+//
+//go:fix inline
+func Sum512(data []byte) [64]byte {
+ return sha3.Sum512(data)
+}
diff --git a/vendor/golang.org/x/crypto/sha3/legacy_hash.go b/vendor/golang.org/x/crypto/sha3/legacy_hash.go
new file mode 100644
index 0000000000..b8784536e0
--- /dev/null
+++ b/vendor/golang.org/x/crypto/sha3/legacy_hash.go
@@ -0,0 +1,263 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sha3
+
+// This implementation is only used for NewLegacyKeccak256 and
+// NewLegacyKeccak512, which are not implemented by crypto/sha3.
+// All other functions in this package are wrappers around crypto/sha3.
+
+import (
+ "crypto/subtle"
+ "encoding/binary"
+ "errors"
+ "hash"
+ "unsafe"
+
+ "golang.org/x/sys/cpu"
+)
+
+const (
+ dsbyteKeccak = 0b00000001
+
+ // rateK[c] is the rate in bytes for Keccak[c] where c is the capacity in
+ // bits. Given the sponge size is 1600 bits, the rate is 1600 - c bits.
+ rateK256 = (1600 - 256) / 8
+ rateK512 = (1600 - 512) / 8
+ rateK1024 = (1600 - 1024) / 8
+)
+
+// NewLegacyKeccak256 creates a new Keccak-256 hash.
+//
+// Only use this function if you require compatibility with an existing cryptosystem
+// that uses non-standard padding. All other users should use New256 instead.
+func NewLegacyKeccak256() hash.Hash {
+ return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteKeccak}
+}
+
+// NewLegacyKeccak512 creates a new Keccak-512 hash.
+//
+// Only use this function if you require compatibility with an existing cryptosystem
+// that uses non-standard padding. All other users should use New512 instead.
+func NewLegacyKeccak512() hash.Hash {
+ return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteKeccak}
+}
+
+// spongeDirection indicates the direction bytes are flowing through the sponge.
+type spongeDirection int
+
+const (
+ // spongeAbsorbing indicates that the sponge is absorbing input.
+ spongeAbsorbing spongeDirection = iota
+ // spongeSqueezing indicates that the sponge is being squeezed.
+ spongeSqueezing
+)
+
+type state struct {
+ a [1600 / 8]byte // main state of the hash
+
+ // a[n:rate] is the buffer. If absorbing, it's the remaining space to XOR
+ // into before running the permutation. If squeezing, it's the remaining
+ // output to produce before running the permutation.
+ n, rate int
+
+ // dsbyte contains the "domain separation" bits and the first bit of
+ // the padding. Sections 6.1 and 6.2 of [1] separate the outputs of the
+ // SHA-3 and SHAKE functions by appending bitstrings to the message.
+ // Using a little-endian bit-ordering convention, these are "01" for SHA-3
+ // and "1111" for SHAKE, or 00000010b and 00001111b, respectively. Then the
+ // padding rule from section 5.1 is applied to pad the message to a multiple
+ // of the rate, which involves adding a "1" bit, zero or more "0" bits, and
+ // a final "1" bit. We merge the first "1" bit from the padding into dsbyte,
+ // giving 00000110b (0x06) and 00011111b (0x1f).
+ // [1] http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf
+ // "Draft FIPS 202: SHA-3 Standard: Permutation-Based Hash and
+ // Extendable-Output Functions (May 2014)"
+ dsbyte byte
+
+ outputLen int // the default output size in bytes
+ state spongeDirection // whether the sponge is absorbing or squeezing
+}
+
+// BlockSize returns the rate of sponge underlying this hash function.
+func (d *state) BlockSize() int { return d.rate }
+
+// Size returns the output size of the hash function in bytes.
+func (d *state) Size() int { return d.outputLen }
+
+// Reset clears the internal state by zeroing the sponge state and
+// the buffer indexes, and setting Sponge.state to absorbing.
+func (d *state) Reset() {
+ // Zero the permutation's state.
+ for i := range d.a {
+ d.a[i] = 0
+ }
+ d.state = spongeAbsorbing
+ d.n = 0
+}
+
+func (d *state) clone() *state {
+ ret := *d
+ return &ret
+}
+
+// permute applies the KeccakF-1600 permutation.
+func (d *state) permute() {
+ var a *[25]uint64
+ if cpu.IsBigEndian {
+ a = new([25]uint64)
+ for i := range a {
+ a[i] = binary.LittleEndian.Uint64(d.a[i*8:])
+ }
+ } else {
+ a = (*[25]uint64)(unsafe.Pointer(&d.a))
+ }
+
+ keccakF1600(a)
+ d.n = 0
+
+ if cpu.IsBigEndian {
+ for i := range a {
+ binary.LittleEndian.PutUint64(d.a[i*8:], a[i])
+ }
+ }
+}
+
+// pads appends the domain separation bits in dsbyte, applies
+// the multi-bitrate 10..1 padding rule, and permutes the state.
+func (d *state) padAndPermute() {
+ // Pad with this instance's domain-separator bits. We know that there's
+ // at least one byte of space in the sponge because, if it were full,
+ // permute would have been called to empty it. dsbyte also contains the
+ // first one bit for the padding. See the comment in the state struct.
+ d.a[d.n] ^= d.dsbyte
+ // This adds the final one bit for the padding. Because of the way that
+ // bits are numbered from the LSB upwards, the final bit is the MSB of
+ // the last byte.
+ d.a[d.rate-1] ^= 0x80
+ // Apply the permutation
+ d.permute()
+ d.state = spongeSqueezing
+}
+
+// Write absorbs more data into the hash's state. It panics if any
+// output has already been read.
+func (d *state) Write(p []byte) (n int, err error) {
+ if d.state != spongeAbsorbing {
+ panic("sha3: Write after Read")
+ }
+
+ n = len(p)
+
+ for len(p) > 0 {
+ x := subtle.XORBytes(d.a[d.n:d.rate], d.a[d.n:d.rate], p)
+ d.n += x
+ p = p[x:]
+
+ // If the sponge is full, apply the permutation.
+ if d.n == d.rate {
+ d.permute()
+ }
+ }
+
+ return
+}
+
+// Read squeezes an arbitrary number of bytes from the sponge.
+func (d *state) Read(out []byte) (n int, err error) {
+ // If we're still absorbing, pad and apply the permutation.
+ if d.state == spongeAbsorbing {
+ d.padAndPermute()
+ }
+
+ n = len(out)
+
+ // Now, do the squeezing.
+ for len(out) > 0 {
+ // Apply the permutation if we've squeezed the sponge dry.
+ if d.n == d.rate {
+ d.permute()
+ }
+
+ x := copy(out, d.a[d.n:d.rate])
+ d.n += x
+ out = out[x:]
+ }
+
+ return
+}
+
+// Sum applies padding to the hash state and then squeezes out the desired
+// number of output bytes. It panics if any output has already been read.
+func (d *state) Sum(in []byte) []byte {
+ if d.state != spongeAbsorbing {
+ panic("sha3: Sum after Read")
+ }
+
+ // Make a copy of the original hash so that caller can keep writing
+ // and summing.
+ dup := d.clone()
+ hash := make([]byte, dup.outputLen, 64) // explicit cap to allow stack allocation
+ dup.Read(hash)
+ return append(in, hash...)
+}
+
+const (
+ magicKeccak = "sha\x0b"
+ // magic || rate || main state || n || sponge direction
+ marshaledSize = len(magicKeccak) + 1 + 200 + 1 + 1
+)
+
+func (d *state) MarshalBinary() ([]byte, error) {
+ return d.AppendBinary(make([]byte, 0, marshaledSize))
+}
+
+func (d *state) AppendBinary(b []byte) ([]byte, error) {
+ switch d.dsbyte {
+ case dsbyteKeccak:
+ b = append(b, magicKeccak...)
+ default:
+ panic("unknown dsbyte")
+ }
+ // rate is at most 168, and n is at most rate.
+ b = append(b, byte(d.rate))
+ b = append(b, d.a[:]...)
+ b = append(b, byte(d.n), byte(d.state))
+ return b, nil
+}
+
+func (d *state) UnmarshalBinary(b []byte) error {
+ if len(b) != marshaledSize {
+ return errors.New("sha3: invalid hash state")
+ }
+
+ magic := string(b[:len(magicKeccak)])
+ b = b[len(magicKeccak):]
+ switch {
+ case magic == magicKeccak && d.dsbyte == dsbyteKeccak:
+ default:
+ return errors.New("sha3: invalid hash state identifier")
+ }
+
+ rate := int(b[0])
+ b = b[1:]
+ if rate != d.rate {
+ return errors.New("sha3: invalid hash state function")
+ }
+
+ copy(d.a[:], b)
+ b = b[len(d.a):]
+
+ n, state := int(b[0]), spongeDirection(b[1])
+ if n > d.rate {
+ return errors.New("sha3: invalid hash state")
+ }
+ d.n = n
+ if state != spongeAbsorbing && state != spongeSqueezing {
+ return errors.New("sha3: invalid hash state")
+ }
+ d.state = state
+
+ return nil
+}
diff --git a/vendor/golang.org/x/crypto/sha3/legacy_keccakf.go b/vendor/golang.org/x/crypto/sha3/legacy_keccakf.go
new file mode 100644
index 0000000000..101588c16c
--- /dev/null
+++ b/vendor/golang.org/x/crypto/sha3/legacy_keccakf.go
@@ -0,0 +1,416 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sha3
+
+// This implementation is only used for NewLegacyKeccak256 and
+// NewLegacyKeccak512, which are not implemented by crypto/sha3.
+// All other functions in this package are wrappers around crypto/sha3.
+
+import "math/bits"
+
+// rc stores the round constants for use in the ι step.
+var rc = [24]uint64{
+ 0x0000000000000001,
+ 0x0000000000008082,
+ 0x800000000000808A,
+ 0x8000000080008000,
+ 0x000000000000808B,
+ 0x0000000080000001,
+ 0x8000000080008081,
+ 0x8000000000008009,
+ 0x000000000000008A,
+ 0x0000000000000088,
+ 0x0000000080008009,
+ 0x000000008000000A,
+ 0x000000008000808B,
+ 0x800000000000008B,
+ 0x8000000000008089,
+ 0x8000000000008003,
+ 0x8000000000008002,
+ 0x8000000000000080,
+ 0x000000000000800A,
+ 0x800000008000000A,
+ 0x8000000080008081,
+ 0x8000000000008080,
+ 0x0000000080000001,
+ 0x8000000080008008,
+}
+
+// keccakF1600 applies the Keccak permutation to a 1600b-wide
+// state represented as a slice of 25 uint64s.
+func keccakF1600(a *[25]uint64) {
+ // Implementation translated from Keccak-inplace.c
+ // in the keccak reference code.
+ var t, bc0, bc1, bc2, bc3, bc4, d0, d1, d2, d3, d4 uint64
+
+ for i := 0; i < 24; i += 4 {
+ // Combines the 5 steps in each round into 2 steps.
+ // Unrolls 4 rounds per loop and spreads some steps across rounds.
+
+ // Round 1
+ bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
+ bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
+ bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
+ bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
+ bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
+ d0 = bc4 ^ (bc1<<1 | bc1>>63)
+ d1 = bc0 ^ (bc2<<1 | bc2>>63)
+ d2 = bc1 ^ (bc3<<1 | bc3>>63)
+ d3 = bc2 ^ (bc4<<1 | bc4>>63)
+ d4 = bc3 ^ (bc0<<1 | bc0>>63)
+
+ bc0 = a[0] ^ d0
+ t = a[6] ^ d1
+ bc1 = bits.RotateLeft64(t, 44)
+ t = a[12] ^ d2
+ bc2 = bits.RotateLeft64(t, 43)
+ t = a[18] ^ d3
+ bc3 = bits.RotateLeft64(t, 21)
+ t = a[24] ^ d4
+ bc4 = bits.RotateLeft64(t, 14)
+ a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i]
+ a[6] = bc1 ^ (bc3 &^ bc2)
+ a[12] = bc2 ^ (bc4 &^ bc3)
+ a[18] = bc3 ^ (bc0 &^ bc4)
+ a[24] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[10] ^ d0
+ bc2 = bits.RotateLeft64(t, 3)
+ t = a[16] ^ d1
+ bc3 = bits.RotateLeft64(t, 45)
+ t = a[22] ^ d2
+ bc4 = bits.RotateLeft64(t, 61)
+ t = a[3] ^ d3
+ bc0 = bits.RotateLeft64(t, 28)
+ t = a[9] ^ d4
+ bc1 = bits.RotateLeft64(t, 20)
+ a[10] = bc0 ^ (bc2 &^ bc1)
+ a[16] = bc1 ^ (bc3 &^ bc2)
+ a[22] = bc2 ^ (bc4 &^ bc3)
+ a[3] = bc3 ^ (bc0 &^ bc4)
+ a[9] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[20] ^ d0
+ bc4 = bits.RotateLeft64(t, 18)
+ t = a[1] ^ d1
+ bc0 = bits.RotateLeft64(t, 1)
+ t = a[7] ^ d2
+ bc1 = bits.RotateLeft64(t, 6)
+ t = a[13] ^ d3
+ bc2 = bits.RotateLeft64(t, 25)
+ t = a[19] ^ d4
+ bc3 = bits.RotateLeft64(t, 8)
+ a[20] = bc0 ^ (bc2 &^ bc1)
+ a[1] = bc1 ^ (bc3 &^ bc2)
+ a[7] = bc2 ^ (bc4 &^ bc3)
+ a[13] = bc3 ^ (bc0 &^ bc4)
+ a[19] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[5] ^ d0
+ bc1 = bits.RotateLeft64(t, 36)
+ t = a[11] ^ d1
+ bc2 = bits.RotateLeft64(t, 10)
+ t = a[17] ^ d2
+ bc3 = bits.RotateLeft64(t, 15)
+ t = a[23] ^ d3
+ bc4 = bits.RotateLeft64(t, 56)
+ t = a[4] ^ d4
+ bc0 = bits.RotateLeft64(t, 27)
+ a[5] = bc0 ^ (bc2 &^ bc1)
+ a[11] = bc1 ^ (bc3 &^ bc2)
+ a[17] = bc2 ^ (bc4 &^ bc3)
+ a[23] = bc3 ^ (bc0 &^ bc4)
+ a[4] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[15] ^ d0
+ bc3 = bits.RotateLeft64(t, 41)
+ t = a[21] ^ d1
+ bc4 = bits.RotateLeft64(t, 2)
+ t = a[2] ^ d2
+ bc0 = bits.RotateLeft64(t, 62)
+ t = a[8] ^ d3
+ bc1 = bits.RotateLeft64(t, 55)
+ t = a[14] ^ d4
+ bc2 = bits.RotateLeft64(t, 39)
+ a[15] = bc0 ^ (bc2 &^ bc1)
+ a[21] = bc1 ^ (bc3 &^ bc2)
+ a[2] = bc2 ^ (bc4 &^ bc3)
+ a[8] = bc3 ^ (bc0 &^ bc4)
+ a[14] = bc4 ^ (bc1 &^ bc0)
+
+ // Round 2
+ bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
+ bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
+ bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
+ bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
+ bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
+ d0 = bc4 ^ (bc1<<1 | bc1>>63)
+ d1 = bc0 ^ (bc2<<1 | bc2>>63)
+ d2 = bc1 ^ (bc3<<1 | bc3>>63)
+ d3 = bc2 ^ (bc4<<1 | bc4>>63)
+ d4 = bc3 ^ (bc0<<1 | bc0>>63)
+
+ bc0 = a[0] ^ d0
+ t = a[16] ^ d1
+ bc1 = bits.RotateLeft64(t, 44)
+ t = a[7] ^ d2
+ bc2 = bits.RotateLeft64(t, 43)
+ t = a[23] ^ d3
+ bc3 = bits.RotateLeft64(t, 21)
+ t = a[14] ^ d4
+ bc4 = bits.RotateLeft64(t, 14)
+ a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+1]
+ a[16] = bc1 ^ (bc3 &^ bc2)
+ a[7] = bc2 ^ (bc4 &^ bc3)
+ a[23] = bc3 ^ (bc0 &^ bc4)
+ a[14] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[20] ^ d0
+ bc2 = bits.RotateLeft64(t, 3)
+ t = a[11] ^ d1
+ bc3 = bits.RotateLeft64(t, 45)
+ t = a[2] ^ d2
+ bc4 = bits.RotateLeft64(t, 61)
+ t = a[18] ^ d3
+ bc0 = bits.RotateLeft64(t, 28)
+ t = a[9] ^ d4
+ bc1 = bits.RotateLeft64(t, 20)
+ a[20] = bc0 ^ (bc2 &^ bc1)
+ a[11] = bc1 ^ (bc3 &^ bc2)
+ a[2] = bc2 ^ (bc4 &^ bc3)
+ a[18] = bc3 ^ (bc0 &^ bc4)
+ a[9] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[15] ^ d0
+ bc4 = bits.RotateLeft64(t, 18)
+ t = a[6] ^ d1
+ bc0 = bits.RotateLeft64(t, 1)
+ t = a[22] ^ d2
+ bc1 = bits.RotateLeft64(t, 6)
+ t = a[13] ^ d3
+ bc2 = bits.RotateLeft64(t, 25)
+ t = a[4] ^ d4
+ bc3 = bits.RotateLeft64(t, 8)
+ a[15] = bc0 ^ (bc2 &^ bc1)
+ a[6] = bc1 ^ (bc3 &^ bc2)
+ a[22] = bc2 ^ (bc4 &^ bc3)
+ a[13] = bc3 ^ (bc0 &^ bc4)
+ a[4] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[10] ^ d0
+ bc1 = bits.RotateLeft64(t, 36)
+ t = a[1] ^ d1
+ bc2 = bits.RotateLeft64(t, 10)
+ t = a[17] ^ d2
+ bc3 = bits.RotateLeft64(t, 15)
+ t = a[8] ^ d3
+ bc4 = bits.RotateLeft64(t, 56)
+ t = a[24] ^ d4
+ bc0 = bits.RotateLeft64(t, 27)
+ a[10] = bc0 ^ (bc2 &^ bc1)
+ a[1] = bc1 ^ (bc3 &^ bc2)
+ a[17] = bc2 ^ (bc4 &^ bc3)
+ a[8] = bc3 ^ (bc0 &^ bc4)
+ a[24] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[5] ^ d0
+ bc3 = bits.RotateLeft64(t, 41)
+ t = a[21] ^ d1
+ bc4 = bits.RotateLeft64(t, 2)
+ t = a[12] ^ d2
+ bc0 = bits.RotateLeft64(t, 62)
+ t = a[3] ^ d3
+ bc1 = bits.RotateLeft64(t, 55)
+ t = a[19] ^ d4
+ bc2 = bits.RotateLeft64(t, 39)
+ a[5] = bc0 ^ (bc2 &^ bc1)
+ a[21] = bc1 ^ (bc3 &^ bc2)
+ a[12] = bc2 ^ (bc4 &^ bc3)
+ a[3] = bc3 ^ (bc0 &^ bc4)
+ a[19] = bc4 ^ (bc1 &^ bc0)
+
+ // Round 3
+ bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
+ bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
+ bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
+ bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
+ bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
+ d0 = bc4 ^ (bc1<<1 | bc1>>63)
+ d1 = bc0 ^ (bc2<<1 | bc2>>63)
+ d2 = bc1 ^ (bc3<<1 | bc3>>63)
+ d3 = bc2 ^ (bc4<<1 | bc4>>63)
+ d4 = bc3 ^ (bc0<<1 | bc0>>63)
+
+ bc0 = a[0] ^ d0
+ t = a[11] ^ d1
+ bc1 = bits.RotateLeft64(t, 44)
+ t = a[22] ^ d2
+ bc2 = bits.RotateLeft64(t, 43)
+ t = a[8] ^ d3
+ bc3 = bits.RotateLeft64(t, 21)
+ t = a[19] ^ d4
+ bc4 = bits.RotateLeft64(t, 14)
+ a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+2]
+ a[11] = bc1 ^ (bc3 &^ bc2)
+ a[22] = bc2 ^ (bc4 &^ bc3)
+ a[8] = bc3 ^ (bc0 &^ bc4)
+ a[19] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[15] ^ d0
+ bc2 = bits.RotateLeft64(t, 3)
+ t = a[1] ^ d1
+ bc3 = bits.RotateLeft64(t, 45)
+ t = a[12] ^ d2
+ bc4 = bits.RotateLeft64(t, 61)
+ t = a[23] ^ d3
+ bc0 = bits.RotateLeft64(t, 28)
+ t = a[9] ^ d4
+ bc1 = bits.RotateLeft64(t, 20)
+ a[15] = bc0 ^ (bc2 &^ bc1)
+ a[1] = bc1 ^ (bc3 &^ bc2)
+ a[12] = bc2 ^ (bc4 &^ bc3)
+ a[23] = bc3 ^ (bc0 &^ bc4)
+ a[9] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[5] ^ d0
+ bc4 = bits.RotateLeft64(t, 18)
+ t = a[16] ^ d1
+ bc0 = bits.RotateLeft64(t, 1)
+ t = a[2] ^ d2
+ bc1 = bits.RotateLeft64(t, 6)
+ t = a[13] ^ d3
+ bc2 = bits.RotateLeft64(t, 25)
+ t = a[24] ^ d4
+ bc3 = bits.RotateLeft64(t, 8)
+ a[5] = bc0 ^ (bc2 &^ bc1)
+ a[16] = bc1 ^ (bc3 &^ bc2)
+ a[2] = bc2 ^ (bc4 &^ bc3)
+ a[13] = bc3 ^ (bc0 &^ bc4)
+ a[24] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[20] ^ d0
+ bc1 = bits.RotateLeft64(t, 36)
+ t = a[6] ^ d1
+ bc2 = bits.RotateLeft64(t, 10)
+ t = a[17] ^ d2
+ bc3 = bits.RotateLeft64(t, 15)
+ t = a[3] ^ d3
+ bc4 = bits.RotateLeft64(t, 56)
+ t = a[14] ^ d4
+ bc0 = bits.RotateLeft64(t, 27)
+ a[20] = bc0 ^ (bc2 &^ bc1)
+ a[6] = bc1 ^ (bc3 &^ bc2)
+ a[17] = bc2 ^ (bc4 &^ bc3)
+ a[3] = bc3 ^ (bc0 &^ bc4)
+ a[14] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[10] ^ d0
+ bc3 = bits.RotateLeft64(t, 41)
+ t = a[21] ^ d1
+ bc4 = bits.RotateLeft64(t, 2)
+ t = a[7] ^ d2
+ bc0 = bits.RotateLeft64(t, 62)
+ t = a[18] ^ d3
+ bc1 = bits.RotateLeft64(t, 55)
+ t = a[4] ^ d4
+ bc2 = bits.RotateLeft64(t, 39)
+ a[10] = bc0 ^ (bc2 &^ bc1)
+ a[21] = bc1 ^ (bc3 &^ bc2)
+ a[7] = bc2 ^ (bc4 &^ bc3)
+ a[18] = bc3 ^ (bc0 &^ bc4)
+ a[4] = bc4 ^ (bc1 &^ bc0)
+
+ // Round 4
+ bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
+ bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
+ bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
+ bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
+ bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
+ d0 = bc4 ^ (bc1<<1 | bc1>>63)
+ d1 = bc0 ^ (bc2<<1 | bc2>>63)
+ d2 = bc1 ^ (bc3<<1 | bc3>>63)
+ d3 = bc2 ^ (bc4<<1 | bc4>>63)
+ d4 = bc3 ^ (bc0<<1 | bc0>>63)
+
+ bc0 = a[0] ^ d0
+ t = a[1] ^ d1
+ bc1 = bits.RotateLeft64(t, 44)
+ t = a[2] ^ d2
+ bc2 = bits.RotateLeft64(t, 43)
+ t = a[3] ^ d3
+ bc3 = bits.RotateLeft64(t, 21)
+ t = a[4] ^ d4
+ bc4 = bits.RotateLeft64(t, 14)
+ a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+3]
+ a[1] = bc1 ^ (bc3 &^ bc2)
+ a[2] = bc2 ^ (bc4 &^ bc3)
+ a[3] = bc3 ^ (bc0 &^ bc4)
+ a[4] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[5] ^ d0
+ bc2 = bits.RotateLeft64(t, 3)
+ t = a[6] ^ d1
+ bc3 = bits.RotateLeft64(t, 45)
+ t = a[7] ^ d2
+ bc4 = bits.RotateLeft64(t, 61)
+ t = a[8] ^ d3
+ bc0 = bits.RotateLeft64(t, 28)
+ t = a[9] ^ d4
+ bc1 = bits.RotateLeft64(t, 20)
+ a[5] = bc0 ^ (bc2 &^ bc1)
+ a[6] = bc1 ^ (bc3 &^ bc2)
+ a[7] = bc2 ^ (bc4 &^ bc3)
+ a[8] = bc3 ^ (bc0 &^ bc4)
+ a[9] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[10] ^ d0
+ bc4 = bits.RotateLeft64(t, 18)
+ t = a[11] ^ d1
+ bc0 = bits.RotateLeft64(t, 1)
+ t = a[12] ^ d2
+ bc1 = bits.RotateLeft64(t, 6)
+ t = a[13] ^ d3
+ bc2 = bits.RotateLeft64(t, 25)
+ t = a[14] ^ d4
+ bc3 = bits.RotateLeft64(t, 8)
+ a[10] = bc0 ^ (bc2 &^ bc1)
+ a[11] = bc1 ^ (bc3 &^ bc2)
+ a[12] = bc2 ^ (bc4 &^ bc3)
+ a[13] = bc3 ^ (bc0 &^ bc4)
+ a[14] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[15] ^ d0
+ bc1 = bits.RotateLeft64(t, 36)
+ t = a[16] ^ d1
+ bc2 = bits.RotateLeft64(t, 10)
+ t = a[17] ^ d2
+ bc3 = bits.RotateLeft64(t, 15)
+ t = a[18] ^ d3
+ bc4 = bits.RotateLeft64(t, 56)
+ t = a[19] ^ d4
+ bc0 = bits.RotateLeft64(t, 27)
+ a[15] = bc0 ^ (bc2 &^ bc1)
+ a[16] = bc1 ^ (bc3 &^ bc2)
+ a[17] = bc2 ^ (bc4 &^ bc3)
+ a[18] = bc3 ^ (bc0 &^ bc4)
+ a[19] = bc4 ^ (bc1 &^ bc0)
+
+ t = a[20] ^ d0
+ bc3 = bits.RotateLeft64(t, 41)
+ t = a[21] ^ d1
+ bc4 = bits.RotateLeft64(t, 2)
+ t = a[22] ^ d2
+ bc0 = bits.RotateLeft64(t, 62)
+ t = a[23] ^ d3
+ bc1 = bits.RotateLeft64(t, 55)
+ t = a[24] ^ d4
+ bc2 = bits.RotateLeft64(t, 39)
+ a[20] = bc0 ^ (bc2 &^ bc1)
+ a[21] = bc1 ^ (bc3 &^ bc2)
+ a[22] = bc2 ^ (bc4 &^ bc3)
+ a[23] = bc3 ^ (bc0 &^ bc4)
+ a[24] = bc4 ^ (bc1 &^ bc0)
+ }
+}
diff --git a/vendor/golang.org/x/crypto/sha3/shake.go b/vendor/golang.org/x/crypto/sha3/shake.go
new file mode 100644
index 0000000000..6f3f70c265
--- /dev/null
+++ b/vendor/golang.org/x/crypto/sha3/shake.go
@@ -0,0 +1,119 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sha3
+
+import (
+ "crypto/sha3"
+ "hash"
+ "io"
+)
+
+// ShakeHash defines the interface to hash functions that support
+// arbitrary-length output. When used as a plain [hash.Hash], it
+// produces minimum-length outputs that provide full-strength generic
+// security.
+type ShakeHash interface {
+ hash.Hash
+
+ // Read reads more output from the hash; reading affects the hash's
+ // state. (ShakeHash.Read is thus very different from Hash.Sum.)
+ // It never returns an error, but subsequent calls to Write or Sum
+ // will panic.
+ io.Reader
+
+ // Clone returns a copy of the ShakeHash in its current state.
+ Clone() ShakeHash
+}
+
+// NewShake128 creates a new SHAKE128 variable-output-length ShakeHash.
+// Its generic security strength is 128 bits against all attacks if at
+// least 32 bytes of its output are used.
+func NewShake128() ShakeHash {
+ return &shakeWrapper{sha3.NewSHAKE128(), 32, false, sha3.NewSHAKE128}
+}
+
+// NewShake256 creates a new SHAKE256 variable-output-length ShakeHash.
+// Its generic security strength is 256 bits against all attacks if
+// at least 64 bytes of its output are used.
+func NewShake256() ShakeHash {
+ return &shakeWrapper{sha3.NewSHAKE256(), 64, false, sha3.NewSHAKE256}
+}
+
+// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash,
+// a customizable variant of SHAKE128.
+// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is
+// desired. S is a customization byte string used for domain separation - two cSHAKE
+// computations on same input with different S yield unrelated outputs.
+// When N and S are both empty, this is equivalent to NewShake128.
+func NewCShake128(N, S []byte) ShakeHash {
+ return &shakeWrapper{sha3.NewCSHAKE128(N, S), 32, false, func() *sha3.SHAKE {
+ return sha3.NewCSHAKE128(N, S)
+ }}
+}
+
+// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash,
+// a customizable variant of SHAKE256.
+// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is
+// desired. S is a customization byte string used for domain separation - two cSHAKE
+// computations on same input with different S yield unrelated outputs.
+// When N and S are both empty, this is equivalent to NewShake256.
+func NewCShake256(N, S []byte) ShakeHash {
+ return &shakeWrapper{sha3.NewCSHAKE256(N, S), 64, false, func() *sha3.SHAKE {
+ return sha3.NewCSHAKE256(N, S)
+ }}
+}
+
+// ShakeSum128 writes an arbitrary-length digest of data into hash.
+func ShakeSum128(hash, data []byte) {
+ h := NewShake128()
+ h.Write(data)
+ h.Read(hash)
+}
+
+// ShakeSum256 writes an arbitrary-length digest of data into hash.
+func ShakeSum256(hash, data []byte) {
+ h := NewShake256()
+ h.Write(data)
+ h.Read(hash)
+}
+
+// shakeWrapper adds the Size, Sum, and Clone methods to a sha3.SHAKE
+// to implement the ShakeHash interface.
+type shakeWrapper struct {
+ *sha3.SHAKE
+ outputLen int
+ squeezing bool
+ newSHAKE func() *sha3.SHAKE
+}
+
+func (w *shakeWrapper) Read(p []byte) (n int, err error) {
+ w.squeezing = true
+ return w.SHAKE.Read(p)
+}
+
+func (w *shakeWrapper) Clone() ShakeHash {
+ s := w.newSHAKE()
+ b, err := w.MarshalBinary()
+ if err != nil {
+ panic(err) // unreachable
+ }
+ if err := s.UnmarshalBinary(b); err != nil {
+ panic(err) // unreachable
+ }
+ return &shakeWrapper{s, w.outputLen, w.squeezing, w.newSHAKE}
+}
+
+func (w *shakeWrapper) Size() int { return w.outputLen }
+
+func (w *shakeWrapper) Sum(b []byte) []byte {
+ if w.squeezing {
+ panic("sha3: Sum after Read")
+ }
+ out := make([]byte, w.outputLen)
+ // Clone the state so that we don't affect future Write calls.
+ s := w.Clone()
+ s.Read(out)
+ return append(b, out...)
+}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
deleted file mode 100644
index a4d1919a9e..0000000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Deprecated: this package moved to golang.org/x/term.
-package terminal
-
-import (
- "io"
-
- "golang.org/x/term"
-)
-
-// EscapeCodes contains escape sequences that can be written to the terminal in
-// order to achieve different styles of text.
-type EscapeCodes = term.EscapeCodes
-
-// Terminal contains the state for running a VT100 terminal that is capable of
-// reading lines of input.
-type Terminal = term.Terminal
-
-// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
-// a local terminal, that terminal must first have been put into raw mode.
-// prompt is a string that is written at the start of each input line (i.e.
-// "> ").
-func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
- return term.NewTerminal(c, prompt)
-}
-
-// ErrPasteIndicator may be returned from ReadLine as the error, in addition
-// to valid line data. It indicates that bracketed paste mode is enabled and
-// that the returned line consists only of pasted data. Programs may wish to
-// interpret pasted data more literally than typed data.
-var ErrPasteIndicator = term.ErrPasteIndicator
-
-// State contains the state of a terminal.
-type State = term.State
-
-// IsTerminal returns whether the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- return term.IsTerminal(fd)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- return term.ReadPassword(fd)
-}
-
-// MakeRaw puts the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- return term.MakeRaw(fd)
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, oldState *State) error {
- return term.Restore(fd, oldState)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- return term.GetState(fd)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- return term.GetSize(fd)
-}
diff --git a/vendor/golang.org/x/text/currency/common.go b/vendor/golang.org/x/text/currency/common.go
new file mode 100644
index 0000000000..fef15be554
--- /dev/null
+++ b/vendor/golang.org/x/text/currency/common.go
@@ -0,0 +1,67 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package currency
+
+import (
+ "time"
+
+ "golang.org/x/text/language"
+)
+
+// This file contains code common to gen.go and the package code.
+
+const (
+ cashShift = 3
+ roundMask = 0x7
+
+ nonTenderBit = 0x8000
+)
+
+// currencyInfo contains information about a currency.
+// bits 0..2: index into roundings for standard rounding
+// bits 3..5: index into roundings for cash rounding
+type currencyInfo byte
+
+// roundingType defines the scale (number of fractional decimals) and increments
+// in terms of units of size 10^-scale. For example, for scale == 2 and
+// increment == 1, the currency is rounded to units of 0.01.
+type roundingType struct {
+ scale, increment uint8
+}
+
+// roundings contains rounding data for currencies. This struct is
+// created by hand as it is very unlikely to change much.
+var roundings = [...]roundingType{
+ {2, 1}, // default
+ {0, 1},
+ {1, 1},
+ {3, 1},
+ {4, 1},
+ {2, 5}, // cash rounding alternative
+ {2, 50},
+}
+
+// regionToCode returns a 16-bit region code. Only two-letter codes are
+// supported. (Three-letter codes are not needed.)
+func regionToCode(r language.Region) uint16 {
+ if s := r.String(); len(s) == 2 {
+ return uint16(s[0])<<8 | uint16(s[1])
+ }
+ return 0
+}
+
+func toDate(t time.Time) uint32 {
+ y := t.Year()
+ if y == 1 {
+ return 0
+ }
+ date := uint32(y) << 4
+ date |= uint32(t.Month())
+ date <<= 5
+ date |= uint32(t.Day())
+ return date
+}
+
+func fromDate(date uint32) time.Time {
+ return time.Date(int(date>>9), time.Month((date>>5)&0xf), int(date&0x1f), 0, 0, 0, 0, time.UTC)
+}
diff --git a/vendor/golang.org/x/text/currency/currency.go b/vendor/golang.org/x/text/currency/currency.go
new file mode 100644
index 0000000000..598ddeff42
--- /dev/null
+++ b/vendor/golang.org/x/text/currency/currency.go
@@ -0,0 +1,185 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:generate go run gen.go gen_common.go -output tables.go
+
+// Package currency contains currency-related functionality.
+//
+// NOTE: the formatting functionality is currently under development and may
+// change without notice.
+package currency // import "golang.org/x/text/currency"
+
+import (
+ "errors"
+ "sort"
+
+ "golang.org/x/text/internal/tag"
+ "golang.org/x/text/language"
+)
+
+// TODO:
+// - language-specific currency names.
+// - currency formatting.
+// - currency information per region
+// - register currency code (there are no private use area)
+
+// TODO: remove Currency type from package language.
+
+// Kind determines the rounding and rendering properties of a currency value.
+type Kind struct {
+ rounding rounding
+ // TODO: formatting type: standard, accounting. See CLDR.
+}
+
+type rounding byte
+
+const (
+ standard rounding = iota
+ cash
+)
+
+var (
+ // Standard defines standard rounding and formatting for currencies.
+ Standard Kind = Kind{rounding: standard}
+
+ // Cash defines rounding and formatting standards for cash transactions.
+ Cash Kind = Kind{rounding: cash}
+
+ // Accounting defines rounding and formatting standards for accounting.
+ Accounting Kind = Kind{rounding: standard}
+)
+
+// Rounding reports the rounding characteristics for the given currency, where
+// scale is the number of fractional decimals and increment is the number of
+// units in terms of 10^(-scale) to which to round to.
+func (k Kind) Rounding(cur Unit) (scale, increment int) {
+ info := currency.Elem(int(cur.index))[3]
+ switch k.rounding {
+ case standard:
+ info &= roundMask
+ case cash:
+ info >>= cashShift
+ }
+ return int(roundings[info].scale), int(roundings[info].increment)
+}
+
+// Unit is an ISO 4217 currency designator.
+type Unit struct {
+ index uint16
+}
+
+// String returns the ISO code of u.
+func (u Unit) String() string {
+ if u.index == 0 {
+ return "XXX"
+ }
+ return currency.Elem(int(u.index))[:3]
+}
+
+// Amount creates an Amount for the given currency unit and amount.
+func (u Unit) Amount(amount interface{}) Amount {
+ // TODO: verify amount is a supported number type
+ return Amount{amount: amount, currency: u}
+}
+
+var (
+ errSyntax = errors.New("currency: tag is not well-formed")
+ errValue = errors.New("currency: tag is not a recognized currency")
+)
+
+// ParseISO parses a 3-letter ISO 4217 currency code. It returns an error if s
+// is not well-formed or not a recognized currency code.
+func ParseISO(s string) (Unit, error) {
+ var buf [4]byte // Take one byte more to detect oversize keys.
+ key := buf[:copy(buf[:], s)]
+ if !tag.FixCase("XXX", key) {
+ return Unit{}, errSyntax
+ }
+ if i := currency.Index(key); i >= 0 {
+ if i == xxx {
+ return Unit{}, nil
+ }
+ return Unit{uint16(i)}, nil
+ }
+ return Unit{}, errValue
+}
+
+// MustParseISO is like ParseISO, but panics if the given currency unit
+// cannot be parsed. It simplifies safe initialization of Unit values.
+func MustParseISO(s string) Unit {
+ c, err := ParseISO(s)
+ if err != nil {
+ panic(err)
+ }
+ return c
+}
+
+// FromRegion reports the currency unit that is currently legal tender in the
+// given region according to CLDR. It will return false if region currently does
+// not have a legal tender.
+func FromRegion(r language.Region) (currency Unit, ok bool) {
+ x := regionToCode(r)
+ i := sort.Search(len(regionToCurrency), func(i int) bool {
+ return regionToCurrency[i].region >= x
+ })
+ if i < len(regionToCurrency) && regionToCurrency[i].region == x {
+ return Unit{regionToCurrency[i].code}, true
+ }
+ return Unit{}, false
+}
+
+// FromTag reports the most likely currency for the given tag. It considers the
+// currency defined in the -u extension and infers the region if necessary.
+func FromTag(t language.Tag) (Unit, language.Confidence) {
+ if cur := t.TypeForKey("cu"); len(cur) == 3 {
+ c, _ := ParseISO(cur)
+ return c, language.Exact
+ }
+ r, conf := t.Region()
+ if cur, ok := FromRegion(r); ok {
+ return cur, conf
+ }
+ return Unit{}, language.No
+}
+
+var (
+ // Undefined and testing.
+ XXX Unit = Unit{}
+ XTS Unit = Unit{xts}
+
+ // G10 currencies https://en.wikipedia.org/wiki/G10_currencies.
+ USD Unit = Unit{usd}
+ EUR Unit = Unit{eur}
+ JPY Unit = Unit{jpy}
+ GBP Unit = Unit{gbp}
+ CHF Unit = Unit{chf}
+ AUD Unit = Unit{aud}
+ NZD Unit = Unit{nzd}
+ CAD Unit = Unit{cad}
+ SEK Unit = Unit{sek}
+ NOK Unit = Unit{nok}
+
+ // Additional common currencies as defined by CLDR.
+ BRL Unit = Unit{brl}
+ CNY Unit = Unit{cny}
+ DKK Unit = Unit{dkk}
+ INR Unit = Unit{inr}
+ RUB Unit = Unit{rub}
+ HKD Unit = Unit{hkd}
+ IDR Unit = Unit{idr}
+ KRW Unit = Unit{krw}
+ MXN Unit = Unit{mxn}
+ PLN Unit = Unit{pln}
+ SAR Unit = Unit{sar}
+ THB Unit = Unit{thb}
+ TRY Unit = Unit{try}
+ TWD Unit = Unit{twd}
+ ZAR Unit = Unit{zar}
+
+ // Precious metals.
+ XAG Unit = Unit{xag}
+ XAU Unit = Unit{xau}
+ XPT Unit = Unit{xpt}
+ XPD Unit = Unit{xpd}
+)
diff --git a/vendor/golang.org/x/text/currency/format.go b/vendor/golang.org/x/text/currency/format.go
new file mode 100644
index 0000000000..cc4570d3b6
--- /dev/null
+++ b/vendor/golang.org/x/text/currency/format.go
@@ -0,0 +1,220 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package currency
+
+import (
+ "fmt"
+ "sort"
+
+ "golang.org/x/text/internal/format"
+ "golang.org/x/text/internal/language/compact"
+ "golang.org/x/text/internal/number"
+
+ "golang.org/x/text/language"
+)
+
+// Amount is an amount-currency unit pair.
+type Amount struct {
+ amount interface{} // Change to decimal(64|128).
+ currency Unit
+}
+
+// Currency reports the currency unit of this amount.
+func (a Amount) Currency() Unit { return a.currency }
+
+// TODO: based on decimal type, but may make sense to customize a bit.
+// func (a Amount) Decimal()
+// func (a Amount) Int() (int64, error)
+// func (a Amount) Fraction() (int64, error)
+// func (a Amount) Rat() *big.Rat
+// func (a Amount) Float() (float64, error)
+// func (a Amount) Scale() uint
+// func (a Amount) Precision() uint
+// func (a Amount) Sign() int
+//
+// Add/Sub/Div/Mul/Round.
+
+// Format implements fmt.Formatter. It accepts format.State for
+// language-specific rendering.
+func (a Amount) Format(s fmt.State, verb rune) {
+ v := formattedValue{
+ currency: a.currency,
+ amount: a.amount,
+ format: defaultFormat,
+ }
+ v.Format(s, verb)
+}
+
+// formattedValue is currency amount or unit that implements language-sensitive
+// formatting.
+type formattedValue struct {
+ currency Unit
+ amount interface{} // Amount, Unit, or number.
+ format *options
+}
+
+// Format implements fmt.Formatter. It accepts format.State for
+// language-specific rendering.
+func (v formattedValue) Format(s fmt.State, verb rune) {
+ var tag language.Tag
+ var lang compact.ID
+ if state, ok := s.(format.State); ok {
+ tag = state.Language()
+ lang, _ = compact.RegionalID(compact.Tag(tag))
+ }
+
+ // Get the options. Use DefaultFormat if not present.
+ opt := v.format
+ if opt == nil {
+ opt = defaultFormat
+ }
+ cur := v.currency
+ if cur.index == 0 {
+ cur = opt.currency
+ }
+
+ sym := opt.symbol(lang, cur)
+ if v.amount != nil {
+ var f number.Formatter
+ f.InitDecimal(tag)
+
+ scale, increment := opt.kind.Rounding(cur)
+ f.RoundingContext.SetScale(scale)
+ f.RoundingContext.Increment = uint32(increment)
+ f.RoundingContext.IncrementScale = uint8(scale)
+ f.RoundingContext.Mode = number.ToNearestAway
+
+ d := f.Append(nil, v.amount)
+
+ fmt.Fprint(s, sym, " ", string(d))
+ } else {
+ fmt.Fprint(s, sym)
+ }
+}
+
+// Formatter decorates a given number, Unit or Amount with formatting options.
+type Formatter func(amount interface{}) formattedValue
+
+// func (f Formatter) Options(opts ...Option) Formatter
+
+// TODO: call this a Formatter or FormatFunc?
+
+var dummy = USD.Amount(0)
+
+// adjust creates a new Formatter based on the adjustments of fn on f.
+func (f Formatter) adjust(fn func(*options)) Formatter {
+ var o options = *(f(dummy).format)
+ fn(&o)
+ return o.format
+}
+
+// Default creates a new Formatter that defaults to currency unit c if a numeric
+// value is passed that is not associated with a currency.
+func (f Formatter) Default(currency Unit) Formatter {
+ return f.adjust(func(o *options) { o.currency = currency })
+}
+
+// Kind sets the kind of the underlying currency unit.
+func (f Formatter) Kind(k Kind) Formatter {
+ return f.adjust(func(o *options) { o.kind = k })
+}
+
+var defaultFormat *options = ISO(dummy).format
+
+var (
+ // Uses Narrow symbols. Overrides Symbol, if present.
+ NarrowSymbol Formatter = Formatter(formNarrow)
+
+ // Use Symbols instead of ISO codes, when available.
+ Symbol Formatter = Formatter(formSymbol)
+
+ // Use ISO code as symbol.
+ ISO Formatter = Formatter(formISO)
+
+ // TODO:
+ // // Use full name as symbol.
+ // Name Formatter
+)
+
+// options configures rendering and rounding options for an Amount.
+type options struct {
+ currency Unit
+ kind Kind
+
+ symbol func(compactIndex compact.ID, c Unit) string
+}
+
+func (o *options) format(amount interface{}) formattedValue {
+ v := formattedValue{format: o}
+ switch x := amount.(type) {
+ case Amount:
+ v.amount = x.amount
+ v.currency = x.currency
+ case *Amount:
+ v.amount = x.amount
+ v.currency = x.currency
+ case Unit:
+ v.currency = x
+ case *Unit:
+ v.currency = *x
+ default:
+ if o.currency.index == 0 {
+ panic("cannot format number without a currency being set")
+ }
+ // TODO: Must be a number.
+ v.amount = x
+ v.currency = o.currency
+ }
+ return v
+}
+
+var (
+ optISO = options{symbol: lookupISO}
+ optSymbol = options{symbol: lookupSymbol}
+ optNarrow = options{symbol: lookupNarrow}
+)
+
+// These need to be functions, rather than curried methods, as curried methods
+// are evaluated at init time, causing tables to be included unconditionally.
+func formISO(x interface{}) formattedValue { return optISO.format(x) }
+func formSymbol(x interface{}) formattedValue { return optSymbol.format(x) }
+func formNarrow(x interface{}) formattedValue { return optNarrow.format(x) }
+
+func lookupISO(x compact.ID, c Unit) string { return c.String() }
+func lookupSymbol(x compact.ID, c Unit) string { return normalSymbol.lookup(x, c) }
+func lookupNarrow(x compact.ID, c Unit) string { return narrowSymbol.lookup(x, c) }
+
+type symbolIndex struct {
+ index []uint16 // position corresponds with compact index of language.
+ data []curToIndex
+}
+
+var (
+ normalSymbol = symbolIndex{normalLangIndex, normalSymIndex}
+ narrowSymbol = symbolIndex{narrowLangIndex, narrowSymIndex}
+)
+
+func (x *symbolIndex) lookup(lang compact.ID, c Unit) string {
+ for {
+ index := x.data[x.index[lang]:x.index[lang+1]]
+ i := sort.Search(len(index), func(i int) bool {
+ return index[i].cur >= c.index
+ })
+ if i < len(index) && index[i].cur == c.index {
+ x := index[i].idx
+ start := x + 1
+ end := start + uint16(symbols[x])
+ if start == end {
+ return c.String()
+ }
+ return symbols[start:end]
+ }
+ if lang == 0 {
+ break
+ }
+ lang = lang.Parent()
+ }
+ return c.String()
+}
diff --git a/vendor/golang.org/x/text/currency/query.go b/vendor/golang.org/x/text/currency/query.go
new file mode 100644
index 0000000000..7bf9430a62
--- /dev/null
+++ b/vendor/golang.org/x/text/currency/query.go
@@ -0,0 +1,152 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package currency
+
+import (
+ "sort"
+ "time"
+
+ "golang.org/x/text/language"
+)
+
+// QueryIter represents a set of Units. The default set includes all Units that
+// are currently in use as legal tender in any Region.
+type QueryIter interface {
+ // Next returns true if there is a next element available.
+ // It must be called before any of the other methods are called.
+ Next() bool
+
+ // Unit returns the unit of the current iteration.
+ Unit() Unit
+
+ // Region returns the Region for the current iteration.
+ Region() language.Region
+
+ // From returns the date from which the unit was used in the region.
+ // It returns false if this date is unknown.
+ From() (time.Time, bool)
+
+ // To returns the date up till which the unit was used in the region.
+ // It returns false if this date is unknown or if the unit is still in use.
+ To() (time.Time, bool)
+
+ // IsTender reports whether the unit is a legal tender in the region during
+ // the specified date range.
+ IsTender() bool
+}
+
+// Query represents a set of Units. The default set includes all Units that are
+// currently in use as legal tender in any Region.
+func Query(options ...QueryOption) QueryIter {
+ it := &iter{
+ end: len(regionData),
+ date: 0xFFFFFFFF,
+ }
+ for _, fn := range options {
+ fn(it)
+ }
+ return it
+}
+
+// NonTender returns a new query that also includes matching Units that are not
+// legal tender.
+var NonTender QueryOption = nonTender
+
+func nonTender(i *iter) {
+ i.nonTender = true
+}
+
+// Historical selects the units for all dates.
+var Historical QueryOption = historical
+
+func historical(i *iter) {
+ i.date = hist
+}
+
+// A QueryOption can be used to change the set of unit information returned by
+// a query.
+type QueryOption func(*iter)
+
+// Date queries the units that were in use at the given point in history.
+func Date(t time.Time) QueryOption {
+ d := toDate(t)
+ return func(i *iter) {
+ i.date = d
+ }
+}
+
+// Region limits the query to only return entries for the given region.
+func Region(r language.Region) QueryOption {
+ p, end := len(regionData), len(regionData)
+ x := regionToCode(r)
+ i := sort.Search(len(regionData), func(i int) bool {
+ return regionData[i].region >= x
+ })
+ if i < len(regionData) && regionData[i].region == x {
+ p = i
+ for i++; i < len(regionData) && regionData[i].region == x; i++ {
+ }
+ end = i
+ }
+ return func(i *iter) {
+ i.p, i.end = p, end
+ }
+}
+
+const (
+ hist = 0x00
+ now = 0xFFFFFFFF
+)
+
+type iter struct {
+ *regionInfo
+ p, end int
+ date uint32
+ nonTender bool
+}
+
+func (i *iter) Next() bool {
+ for ; i.p < i.end; i.p++ {
+ i.regionInfo = ®ionData[i.p]
+ if !i.nonTender && !i.IsTender() {
+ continue
+ }
+ if i.date == hist || (i.from <= i.date && (i.to == 0 || i.date <= i.to)) {
+ i.p++
+ return true
+ }
+ }
+ return false
+}
+
+func (r *regionInfo) Region() language.Region {
+ // TODO: this could be much faster.
+ var buf [2]byte
+ buf[0] = uint8(r.region >> 8)
+ buf[1] = uint8(r.region)
+ return language.MustParseRegion(string(buf[:]))
+}
+
+func (r *regionInfo) Unit() Unit {
+ return Unit{r.code &^ nonTenderBit}
+}
+
+func (r *regionInfo) IsTender() bool {
+ return r.code&nonTenderBit == 0
+}
+
+func (r *regionInfo) From() (time.Time, bool) {
+ if r.from == 0 {
+ return time.Time{}, false
+ }
+ return fromDate(r.from), true
+}
+
+func (r *regionInfo) To() (time.Time, bool) {
+ if r.to == 0 {
+ return time.Time{}, false
+ }
+ return fromDate(r.to), true
+}
diff --git a/vendor/golang.org/x/text/currency/tables.go b/vendor/golang.org/x/text/currency/tables.go
new file mode 100644
index 0000000000..d1a7440a6b
--- /dev/null
+++ b/vendor/golang.org/x/text/currency/tables.go
@@ -0,0 +1,2629 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package currency
+
+import "golang.org/x/text/internal/tag"
+
+// CLDRVersion is the CLDR version from which the tables in this package are derived.
+const CLDRVersion = "32"
+
+const (
+ xxx = 285
+ xts = 283
+ usd = 252
+ eur = 94
+ jpy = 133
+ gbp = 99
+ chf = 61
+ aud = 19
+ nzd = 192
+ cad = 58
+ sek = 219
+ nok = 190
+ dkk = 82
+ xag = 266
+ xau = 267
+ xpt = 280
+ xpd = 278
+ brl = 46
+ cny = 68
+ inr = 125
+ rub = 210
+ hkd = 114
+ idr = 120
+ krw = 141
+ mxn = 178
+ pln = 201
+ sar = 213
+ thb = 235
+ try = 244
+ twd = 246
+ zar = 293
+)
+
+// currency holds an alphabetically sorted list of canonical 3-letter currency
+// identifiers. Each identifier is followed by a byte of type currencyInfo,
+// defined in gen_common.go.
+const currency tag.Index = "" + // Size: 1208 bytes
+ "\x00\x00\x00\x00ADP\x09AED\x00AFA\x00AFN\x09ALK\x00ALL\x09AMD\x09ANG\x00" +
+ "AOA\x00AOK\x00AON\x00AOR\x00ARA\x00ARL\x00ARM\x00ARP\x00ARS\x00ATS\x00AU" +
+ "D\x00AWG\x00AZM\x00AZN\x00BAD\x00BAM\x00BAN\x00BBD\x00BDT\x00BEC\x00BEF" +
+ "\x00BEL\x00BGL\x00BGM\x00BGN\x00BGO\x00BHD\x1bBIF\x09BMD\x00BND\x00BOB" +
+ "\x00BOL\x00BOP\x00BOV\x00BRB\x00BRC\x00BRE\x00BRL\x00BRN\x00BRR\x00BRZ" +
+ "\x00BSD\x00BTN\x00BUK\x00BWP\x00BYB\x00BYN\x00BYR\x09BZD\x00CAD(CDF\x00C" +
+ "HE\x00CHF(CHW\x00CLE\x00CLF$CLP\x09CNH\x00CNX\x00CNY\x00COP\x09COU\x00CR" +
+ "C\x08CSD\x00CSK\x00CUC\x00CUP\x00CVE\x00CYP\x00CZK\x08DDM\x00DEM\x00DJF" +
+ "\x09DKK0DOP\x00DZD\x00ECS\x00ECV\x00EEK\x00EGP\x00ERN\x00ESA\x00ESB\x00E" +
+ "SP\x09ETB\x00EUR\x00FIM\x00FJD\x00FKP\x00FRF\x00GBP\x00GEK\x00GEL\x00GHC" +
+ "\x00GHS\x00GIP\x00GMD\x00GNF\x09GNS\x00GQE\x00GRD\x00GTQ\x00GWE\x00GWP" +
+ "\x00GYD\x09HKD\x00HNL\x00HRD\x00HRK\x00HTG\x00HUF\x08IDR\x09IEP\x00ILP" +
+ "\x00ILR\x00ILS\x00INR\x00IQD\x09IRR\x09ISJ\x00ISK\x09ITL\x09JMD\x00JOD" +
+ "\x1bJPY\x09KES\x00KGS\x00KHR\x00KMF\x09KPW\x09KRH\x00KRO\x00KRW\x09KWD" +
+ "\x1bKYD\x00KZT\x00LAK\x09LBP\x09LKR\x00LRD\x00LSL\x00LTL\x00LTT\x00LUC" +
+ "\x00LUF\x09LUL\x00LVL\x00LVR\x00LYD\x1bMAD\x00MAF\x00MCF\x00MDC\x00MDL" +
+ "\x00MGA\x09MGF\x09MKD\x00MKN\x00MLF\x00MMK\x09MNT\x09MOP\x00MRO\x09MTL" +
+ "\x00MTP\x00MUR\x09MVP\x00MVR\x00MWK\x00MXN\x00MXP\x00MXV\x00MYR\x00MZE" +
+ "\x00MZM\x00MZN\x00NAD\x00NGN\x00NIC\x00NIO\x00NLG\x00NOK\x08NPR\x00NZD" +
+ "\x00OMR\x1bPAB\x00PEI\x00PEN\x00PES\x00PGK\x00PHP\x00PKR\x09PLN\x00PLZ" +
+ "\x00PTE\x00PYG\x09QAR\x00RHD\x00ROL\x00RON\x00RSD\x09RUB\x00RUR\x00RWF" +
+ "\x09SAR\x00SBD\x00SCR\x00SDD\x00SDG\x00SDP\x00SEK\x08SGD\x00SHP\x00SIT" +
+ "\x00SKK\x00SLL\x09SOS\x09SRD\x00SRG\x00SSP\x00STD\x09STN\x00SUR\x00SVC" +
+ "\x00SYP\x09SZL\x00THB\x00TJR\x00TJS\x00TMM\x09TMT\x00TND\x1bTOP\x00TPE" +
+ "\x00TRL\x09TRY\x00TTD\x00TWD\x08TZS\x09UAH\x00UAK\x00UGS\x00UGX\x09USD" +
+ "\x00USN\x00USS\x00UYI\x09UYP\x00UYU\x00UZS\x09VEB\x00VEF\x00VND\x09VNN" +
+ "\x00VUV\x09WST\x00XAF\x09XAG\x00XAU\x00XBA\x00XBB\x00XBC\x00XBD\x00XCD" +
+ "\x00XDR\x00XEU\x00XFO\x00XFU\x00XOF\x09XPD\x00XPF\x09XPT\x00XRE\x00XSU" +
+ "\x00XTS\x00XUA\x00XXX\x00YDD\x00YER\x09YUD\x00YUM\x00YUN\x00YUR\x00ZAL" +
+ "\x00ZAR\x00ZMK\x09ZMW\x00ZRN\x00ZRZ\x00ZWD\x09ZWL\x00ZWR\x00\xff\xff\xff" +
+ "\xff"
+
+const numCurrencies = 300
+
+type toCurrency struct {
+ region uint16
+ code uint16
+}
+
+var regionToCurrency = []toCurrency{ // 255 elements
+ 0: {region: 0x4143, code: 0xdd},
+ 1: {region: 0x4144, code: 0x5e},
+ 2: {region: 0x4145, code: 0x2},
+ 3: {region: 0x4146, code: 0x4},
+ 4: {region: 0x4147, code: 0x110},
+ 5: {region: 0x4149, code: 0x110},
+ 6: {region: 0x414c, code: 0x6},
+ 7: {region: 0x414d, code: 0x7},
+ 8: {region: 0x414f, code: 0x9},
+ 9: {region: 0x4152, code: 0x11},
+ 10: {region: 0x4153, code: 0xfc},
+ 11: {region: 0x4154, code: 0x5e},
+ 12: {region: 0x4155, code: 0x13},
+ 13: {region: 0x4157, code: 0x14},
+ 14: {region: 0x4158, code: 0x5e},
+ 15: {region: 0x415a, code: 0x16},
+ 16: {region: 0x4241, code: 0x18},
+ 17: {region: 0x4242, code: 0x1a},
+ 18: {region: 0x4244, code: 0x1b},
+ 19: {region: 0x4245, code: 0x5e},
+ 20: {region: 0x4246, code: 0x115},
+ 21: {region: 0x4247, code: 0x21},
+ 22: {region: 0x4248, code: 0x23},
+ 23: {region: 0x4249, code: 0x24},
+ 24: {region: 0x424a, code: 0x115},
+ 25: {region: 0x424c, code: 0x5e},
+ 26: {region: 0x424d, code: 0x25},
+ 27: {region: 0x424e, code: 0x26},
+ 28: {region: 0x424f, code: 0x27},
+ 29: {region: 0x4251, code: 0xfc},
+ 30: {region: 0x4252, code: 0x2e},
+ 31: {region: 0x4253, code: 0x32},
+ 32: {region: 0x4254, code: 0x33},
+ 33: {region: 0x4256, code: 0xbe},
+ 34: {region: 0x4257, code: 0x35},
+ 35: {region: 0x4259, code: 0x37},
+ 36: {region: 0x425a, code: 0x39},
+ 37: {region: 0x4341, code: 0x3a},
+ 38: {region: 0x4343, code: 0x13},
+ 39: {region: 0x4344, code: 0x3b},
+ 40: {region: 0x4346, code: 0x109},
+ 41: {region: 0x4347, code: 0x109},
+ 42: {region: 0x4348, code: 0x3d},
+ 43: {region: 0x4349, code: 0x115},
+ 44: {region: 0x434b, code: 0xc0},
+ 45: {region: 0x434c, code: 0x41},
+ 46: {region: 0x434d, code: 0x109},
+ 47: {region: 0x434e, code: 0x44},
+ 48: {region: 0x434f, code: 0x45},
+ 49: {region: 0x4352, code: 0x47},
+ 50: {region: 0x4355, code: 0x4b},
+ 51: {region: 0x4356, code: 0x4c},
+ 52: {region: 0x4357, code: 0x8},
+ 53: {region: 0x4358, code: 0x13},
+ 54: {region: 0x4359, code: 0x5e},
+ 55: {region: 0x435a, code: 0x4e},
+ 56: {region: 0x4445, code: 0x5e},
+ 57: {region: 0x4447, code: 0xfc},
+ 58: {region: 0x444a, code: 0x51},
+ 59: {region: 0x444b, code: 0x52},
+ 60: {region: 0x444d, code: 0x110},
+ 61: {region: 0x444f, code: 0x53},
+ 62: {region: 0x445a, code: 0x54},
+ 63: {region: 0x4541, code: 0x5e},
+ 64: {region: 0x4543, code: 0xfc},
+ 65: {region: 0x4545, code: 0x5e},
+ 66: {region: 0x4547, code: 0x58},
+ 67: {region: 0x4548, code: 0x9e},
+ 68: {region: 0x4552, code: 0x59},
+ 69: {region: 0x4553, code: 0x5e},
+ 70: {region: 0x4554, code: 0x5d},
+ 71: {region: 0x4555, code: 0x5e},
+ 72: {region: 0x4649, code: 0x5e},
+ 73: {region: 0x464a, code: 0x60},
+ 74: {region: 0x464b, code: 0x61},
+ 75: {region: 0x464d, code: 0xfc},
+ 76: {region: 0x464f, code: 0x52},
+ 77: {region: 0x4652, code: 0x5e},
+ 78: {region: 0x4741, code: 0x109},
+ 79: {region: 0x4742, code: 0x63},
+ 80: {region: 0x4744, code: 0x110},
+ 81: {region: 0x4745, code: 0x65},
+ 82: {region: 0x4746, code: 0x5e},
+ 83: {region: 0x4747, code: 0x63},
+ 84: {region: 0x4748, code: 0x67},
+ 85: {region: 0x4749, code: 0x68},
+ 86: {region: 0x474c, code: 0x52},
+ 87: {region: 0x474d, code: 0x69},
+ 88: {region: 0x474e, code: 0x6a},
+ 89: {region: 0x4750, code: 0x5e},
+ 90: {region: 0x4751, code: 0x109},
+ 91: {region: 0x4752, code: 0x5e},
+ 92: {region: 0x4753, code: 0x63},
+ 93: {region: 0x4754, code: 0x6e},
+ 94: {region: 0x4755, code: 0xfc},
+ 95: {region: 0x4757, code: 0x115},
+ 96: {region: 0x4759, code: 0x71},
+ 97: {region: 0x484b, code: 0x72},
+ 98: {region: 0x484d, code: 0x13},
+ 99: {region: 0x484e, code: 0x73},
+ 100: {region: 0x4852, code: 0x75},
+ 101: {region: 0x4854, code: 0x76},
+ 102: {region: 0x4855, code: 0x77},
+ 103: {region: 0x4943, code: 0x5e},
+ 104: {region: 0x4944, code: 0x78},
+ 105: {region: 0x4945, code: 0x5e},
+ 106: {region: 0x494c, code: 0x7c},
+ 107: {region: 0x494d, code: 0x63},
+ 108: {region: 0x494e, code: 0x7d},
+ 109: {region: 0x494f, code: 0xfc},
+ 110: {region: 0x4951, code: 0x7e},
+ 111: {region: 0x4952, code: 0x7f},
+ 112: {region: 0x4953, code: 0x81},
+ 113: {region: 0x4954, code: 0x5e},
+ 114: {region: 0x4a45, code: 0x63},
+ 115: {region: 0x4a4d, code: 0x83},
+ 116: {region: 0x4a4f, code: 0x84},
+ 117: {region: 0x4a50, code: 0x85},
+ 118: {region: 0x4b45, code: 0x86},
+ 119: {region: 0x4b47, code: 0x87},
+ 120: {region: 0x4b48, code: 0x88},
+ 121: {region: 0x4b49, code: 0x13},
+ 122: {region: 0x4b4d, code: 0x89},
+ 123: {region: 0x4b4e, code: 0x110},
+ 124: {region: 0x4b50, code: 0x8a},
+ 125: {region: 0x4b52, code: 0x8d},
+ 126: {region: 0x4b57, code: 0x8e},
+ 127: {region: 0x4b59, code: 0x8f},
+ 128: {region: 0x4b5a, code: 0x90},
+ 129: {region: 0x4c41, code: 0x91},
+ 130: {region: 0x4c42, code: 0x92},
+ 131: {region: 0x4c43, code: 0x110},
+ 132: {region: 0x4c49, code: 0x3d},
+ 133: {region: 0x4c4b, code: 0x93},
+ 134: {region: 0x4c52, code: 0x94},
+ 135: {region: 0x4c53, code: 0x125},
+ 136: {region: 0x4c54, code: 0x5e},
+ 137: {region: 0x4c55, code: 0x5e},
+ 138: {region: 0x4c56, code: 0x5e},
+ 139: {region: 0x4c59, code: 0x9d},
+ 140: {region: 0x4d41, code: 0x9e},
+ 141: {region: 0x4d43, code: 0x5e},
+ 142: {region: 0x4d44, code: 0xa2},
+ 143: {region: 0x4d45, code: 0x5e},
+ 144: {region: 0x4d46, code: 0x5e},
+ 145: {region: 0x4d47, code: 0xa3},
+ 146: {region: 0x4d48, code: 0xfc},
+ 147: {region: 0x4d4b, code: 0xa5},
+ 148: {region: 0x4d4c, code: 0x115},
+ 149: {region: 0x4d4d, code: 0xa8},
+ 150: {region: 0x4d4e, code: 0xa9},
+ 151: {region: 0x4d4f, code: 0xaa},
+ 152: {region: 0x4d50, code: 0xfc},
+ 153: {region: 0x4d51, code: 0x5e},
+ 154: {region: 0x4d52, code: 0xab},
+ 155: {region: 0x4d53, code: 0x110},
+ 156: {region: 0x4d54, code: 0x5e},
+ 157: {region: 0x4d55, code: 0xae},
+ 158: {region: 0x4d56, code: 0xb0},
+ 159: {region: 0x4d57, code: 0xb1},
+ 160: {region: 0x4d58, code: 0xb2},
+ 161: {region: 0x4d59, code: 0xb5},
+ 162: {region: 0x4d5a, code: 0xb8},
+ 163: {region: 0x4e41, code: 0xb9},
+ 164: {region: 0x4e43, code: 0x117},
+ 165: {region: 0x4e45, code: 0x115},
+ 166: {region: 0x4e46, code: 0x13},
+ 167: {region: 0x4e47, code: 0xba},
+ 168: {region: 0x4e49, code: 0xbc},
+ 169: {region: 0x4e4c, code: 0x5e},
+ 170: {region: 0x4e4f, code: 0xbe},
+ 171: {region: 0x4e50, code: 0xbf},
+ 172: {region: 0x4e52, code: 0x13},
+ 173: {region: 0x4e55, code: 0xc0},
+ 174: {region: 0x4e5a, code: 0xc0},
+ 175: {region: 0x4f4d, code: 0xc1},
+ 176: {region: 0x5041, code: 0xc2},
+ 177: {region: 0x5045, code: 0xc4},
+ 178: {region: 0x5046, code: 0x117},
+ 179: {region: 0x5047, code: 0xc6},
+ 180: {region: 0x5048, code: 0xc7},
+ 181: {region: 0x504b, code: 0xc8},
+ 182: {region: 0x504c, code: 0xc9},
+ 183: {region: 0x504d, code: 0x5e},
+ 184: {region: 0x504e, code: 0xc0},
+ 185: {region: 0x5052, code: 0xfc},
+ 186: {region: 0x5053, code: 0x7c},
+ 187: {region: 0x5054, code: 0x5e},
+ 188: {region: 0x5057, code: 0xfc},
+ 189: {region: 0x5059, code: 0xcc},
+ 190: {region: 0x5141, code: 0xcd},
+ 191: {region: 0x5245, code: 0x5e},
+ 192: {region: 0x524f, code: 0xd0},
+ 193: {region: 0x5253, code: 0xd1},
+ 194: {region: 0x5255, code: 0xd2},
+ 195: {region: 0x5257, code: 0xd4},
+ 196: {region: 0x5341, code: 0xd5},
+ 197: {region: 0x5342, code: 0xd6},
+ 198: {region: 0x5343, code: 0xd7},
+ 199: {region: 0x5344, code: 0xd9},
+ 200: {region: 0x5345, code: 0xdb},
+ 201: {region: 0x5347, code: 0xdc},
+ 202: {region: 0x5348, code: 0xdd},
+ 203: {region: 0x5349, code: 0x5e},
+ 204: {region: 0x534a, code: 0xbe},
+ 205: {region: 0x534b, code: 0x5e},
+ 206: {region: 0x534c, code: 0xe0},
+ 207: {region: 0x534d, code: 0x5e},
+ 208: {region: 0x534e, code: 0x115},
+ 209: {region: 0x534f, code: 0xe1},
+ 210: {region: 0x5352, code: 0xe2},
+ 211: {region: 0x5353, code: 0xe4},
+ 212: {region: 0x5354, code: 0xe6},
+ 213: {region: 0x5356, code: 0xfc},
+ 214: {region: 0x5358, code: 0x8},
+ 215: {region: 0x5359, code: 0xe9},
+ 216: {region: 0x535a, code: 0xea},
+ 217: {region: 0x5441, code: 0x63},
+ 218: {region: 0x5443, code: 0xfc},
+ 219: {region: 0x5444, code: 0x109},
+ 220: {region: 0x5446, code: 0x5e},
+ 221: {region: 0x5447, code: 0x115},
+ 222: {region: 0x5448, code: 0xeb},
+ 223: {region: 0x544a, code: 0xed},
+ 224: {region: 0x544b, code: 0xc0},
+ 225: {region: 0x544c, code: 0xfc},
+ 226: {region: 0x544d, code: 0xef},
+ 227: {region: 0x544e, code: 0xf0},
+ 228: {region: 0x544f, code: 0xf1},
+ 229: {region: 0x5452, code: 0xf4},
+ 230: {region: 0x5454, code: 0xf5},
+ 231: {region: 0x5456, code: 0x13},
+ 232: {region: 0x5457, code: 0xf6},
+ 233: {region: 0x545a, code: 0xf7},
+ 234: {region: 0x5541, code: 0xf8},
+ 235: {region: 0x5547, code: 0xfb},
+ 236: {region: 0x554d, code: 0xfc},
+ 237: {region: 0x5553, code: 0xfc},
+ 238: {region: 0x5559, code: 0x101},
+ 239: {region: 0x555a, code: 0x102},
+ 240: {region: 0x5641, code: 0x5e},
+ 241: {region: 0x5643, code: 0x110},
+ 242: {region: 0x5645, code: 0x104},
+ 243: {region: 0x5647, code: 0xfc},
+ 244: {region: 0x5649, code: 0xfc},
+ 245: {region: 0x564e, code: 0x105},
+ 246: {region: 0x5655, code: 0x107},
+ 247: {region: 0x5746, code: 0x117},
+ 248: {region: 0x5753, code: 0x108},
+ 249: {region: 0x584b, code: 0x5e},
+ 250: {region: 0x5945, code: 0x11f},
+ 251: {region: 0x5954, code: 0x5e},
+ 252: {region: 0x5a41, code: 0x125},
+ 253: {region: 0x5a4d, code: 0x127},
+ 254: {region: 0x5a57, code: 0xfc},
+} // Size: 1044 bytes
+
+type regionInfo struct {
+ region uint16
+ code uint16
+ from uint32
+ to uint32
+}
+
+var regionData = []regionInfo{ // 495 elements
+ 0: {region: 0x4143, code: 0xdd, from: 0xf7021, to: 0x0},
+ 1: {region: 0x4144, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 2: {region: 0x4144, code: 0x5c, from: 0xea221, to: 0xfa45c},
+ 3: {region: 0x4144, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 4: {region: 0x4144, code: 0x1, from: 0xf2021, to: 0xfa39f},
+ 5: {region: 0x4145, code: 0x2, from: 0xf6ab3, to: 0x0},
+ 6: {region: 0x4146, code: 0x4, from: 0xfa547, to: 0x0},
+ 7: {region: 0x4146, code: 0x3, from: 0xf0e6e, to: 0xfa59f},
+ 8: {region: 0x4147, code: 0x110, from: 0xf5b46, to: 0x0},
+ 9: {region: 0x4149, code: 0x110, from: 0xf5b46, to: 0x0},
+ 10: {region: 0x414c, code: 0x6, from: 0xf5b10, to: 0x0},
+ 11: {region: 0x414c, code: 0x5, from: 0xf3561, to: 0xf5b10},
+ 12: {region: 0x414d, code: 0x7, from: 0xf9376, to: 0x0},
+ 13: {region: 0x414d, code: 0xd3, from: 0xf8f99, to: 0xf9376},
+ 14: {region: 0x414d, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 15: {region: 0x414f, code: 0x9, from: 0xf9f8d, to: 0x0},
+ 16: {region: 0x414f, code: 0xc, from: 0xf96e1, to: 0xfa041},
+ 17: {region: 0x414f, code: 0xb, from: 0xf8d39, to: 0xfa041},
+ 18: {region: 0x414f, code: 0xa, from: 0xf7228, to: 0xf8e61},
+ 19: {region: 0x4151, code: 0x811d, from: 0x0, to: 0x0},
+ 20: {region: 0x4152, code: 0x11, from: 0xf9021, to: 0x0},
+ 21: {region: 0x4152, code: 0xd, from: 0xf82ce, to: 0xf9021},
+ 22: {region: 0x4152, code: 0x10, from: 0xf7ec1, to: 0xf82ce},
+ 23: {region: 0x4152, code: 0xe, from: 0xf6421, to: 0xf7ec1},
+ 24: {region: 0x4152, code: 0xf, from: 0xeb365, to: 0xf6421},
+ 25: {region: 0x4153, code: 0xfc, from: 0xee0f0, to: 0x0},
+ 26: {region: 0x4154, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 27: {region: 0x4154, code: 0x12, from: 0xf3784, to: 0xfa45c},
+ 28: {region: 0x4155, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 29: {region: 0x4157, code: 0x14, from: 0xf8421, to: 0x0},
+ 30: {region: 0x4157, code: 0x8, from: 0xf28aa, to: 0xf8421},
+ 31: {region: 0x4158, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 32: {region: 0x415a, code: 0x16, from: 0xfac21, to: 0x0},
+ 33: {region: 0x415a, code: 0x15, from: 0xf9376, to: 0xfad9f},
+ 34: {region: 0x415a, code: 0xd3, from: 0xf8f99, to: 0xf9421},
+ 35: {region: 0x415a, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 36: {region: 0x4241, code: 0x18, from: 0xf9621, to: 0x0},
+ 37: {region: 0x4241, code: 0x19, from: 0xf950f, to: 0xf9ae1},
+ 38: {region: 0x4241, code: 0x17, from: 0xf90e1, to: 0xf950f},
+ 39: {region: 0x4241, code: 0x123, from: 0xf90e1, to: 0xf9341},
+ 40: {region: 0x4241, code: 0x122, from: 0xf8c21, to: 0xf90e1},
+ 41: {region: 0x4241, code: 0x120, from: 0xf5c21, to: 0xf8c21},
+ 42: {region: 0x4242, code: 0x1a, from: 0xf6b83, to: 0x0},
+ 43: {region: 0x4242, code: 0x110, from: 0xf5b46, to: 0xf6b83},
+ 44: {region: 0x4244, code: 0x1b, from: 0xf6821, to: 0x0},
+ 45: {region: 0x4244, code: 0xc8, from: 0xf3881, to: 0xf6821},
+ 46: {region: 0x4244, code: 0x7d, from: 0xe5711, to: 0xf3881},
+ 47: {region: 0x4245, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 48: {region: 0x4245, code: 0x1d, from: 0xe4e47, to: 0xfa45c},
+ 49: {region: 0x4245, code: 0xbd, from: 0xe318f, to: 0xe4e47},
+ 50: {region: 0x4245, code: 0x801e, from: 0xf6421, to: 0xf8c65},
+ 51: {region: 0x4245, code: 0x801c, from: 0xf6421, to: 0xf8c65},
+ 52: {region: 0x4246, code: 0x115, from: 0xf8104, to: 0x0},
+ 53: {region: 0x4247, code: 0x21, from: 0xf9ee5, to: 0x0},
+ 54: {region: 0x4247, code: 0x1f, from: 0xf5421, to: 0xf9ee5},
+ 55: {region: 0x4247, code: 0x20, from: 0xf40ac, to: 0xf5421},
+ 56: {region: 0x4247, code: 0x22, from: 0xeaee8, to: 0xf40ac},
+ 57: {region: 0x4248, code: 0x23, from: 0xf5b50, to: 0x0},
+ 58: {region: 0x4249, code: 0x24, from: 0xf58b3, to: 0x0},
+ 59: {region: 0x424a, code: 0x115, from: 0xf6f7e, to: 0x0},
+ 60: {region: 0x424c, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 61: {region: 0x424c, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 62: {region: 0x424d, code: 0x25, from: 0xf6446, to: 0x0},
+ 63: {region: 0x424e, code: 0x26, from: 0xf5ecc, to: 0x0},
+ 64: {region: 0x424e, code: 0xb5, from: 0xf5730, to: 0xf5ecc},
+ 65: {region: 0x424f, code: 0x27, from: 0xf8621, to: 0x0},
+ 66: {region: 0x424f, code: 0x29, from: 0xf5621, to: 0xf859f},
+ 67: {region: 0x424f, code: 0x28, from: 0xe8ed7, to: 0xf5621},
+ 68: {region: 0x424f, code: 0x802a, from: 0x0, to: 0x0},
+ 69: {region: 0x4251, code: 0xfc, from: 0xfb621, to: 0x0},
+ 70: {region: 0x4251, code: 0x8, from: 0xfb54a, to: 0xfb621},
+ 71: {region: 0x4252, code: 0x2e, from: 0xf94e1, to: 0x0},
+ 72: {region: 0x4252, code: 0x30, from: 0xf9301, to: 0xf94e1},
+ 73: {region: 0x4252, code: 0x2d, from: 0xf8c70, to: 0xf9301},
+ 74: {region: 0x4252, code: 0x2f, from: 0xf8a2f, to: 0xf8c70},
+ 75: {region: 0x4252, code: 0x2c, from: 0xf845c, to: 0xf8a2f},
+ 76: {region: 0x4252, code: 0x2b, from: 0xf5e4d, to: 0xf845c},
+ 77: {region: 0x4252, code: 0x31, from: 0xf2d61, to: 0xf5e4d},
+ 78: {region: 0x4253, code: 0x32, from: 0xf5cb9, to: 0x0},
+ 79: {region: 0x4254, code: 0x33, from: 0xf6c90, to: 0x0},
+ 80: {region: 0x4254, code: 0x7d, from: 0xee621, to: 0x0},
+ 81: {region: 0x4255, code: 0x34, from: 0xf40e1, to: 0xf8ad2},
+ 82: {region: 0x4256, code: 0xbe, from: 0xee2c7, to: 0x0},
+ 83: {region: 0x4257, code: 0x35, from: 0xf7117, to: 0x0},
+ 84: {region: 0x4257, code: 0x125, from: 0xf524e, to: 0xf7117},
+ 85: {region: 0x4259, code: 0x37, from: 0xfc0e1, to: 0x0},
+ 86: {region: 0x4259, code: 0x38, from: 0xfa021, to: 0xfc221},
+ 87: {region: 0x4259, code: 0x36, from: 0xf9501, to: 0xfa19f},
+ 88: {region: 0x4259, code: 0xd3, from: 0xf8f99, to: 0xf9568},
+ 89: {region: 0x4259, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 90: {region: 0x425a, code: 0x39, from: 0xf6c21, to: 0x0},
+ 91: {region: 0x4341, code: 0x3a, from: 0xe8421, to: 0x0},
+ 92: {region: 0x4343, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 93: {region: 0x4344, code: 0x3b, from: 0xf9ce1, to: 0x0},
+ 94: {region: 0x4344, code: 0x128, from: 0xf9361, to: 0xf9ce1},
+ 95: {region: 0x4344, code: 0x129, from: 0xf675b, to: 0xf9361},
+ 96: {region: 0x4346, code: 0x109, from: 0xf9221, to: 0x0},
+ 97: {region: 0x4347, code: 0x109, from: 0xf9221, to: 0x0},
+ 98: {region: 0x4348, code: 0x3d, from: 0xe0e71, to: 0x0},
+ 99: {region: 0x4348, code: 0x803c, from: 0x0, to: 0x0},
+ 100: {region: 0x4348, code: 0x803e, from: 0x0, to: 0x0},
+ 101: {region: 0x4349, code: 0x115, from: 0xf4d84, to: 0x0},
+ 102: {region: 0x434b, code: 0xc0, from: 0xf5eea, to: 0x0},
+ 103: {region: 0x434c, code: 0x41, from: 0xf6f3d, to: 0x0},
+ 104: {region: 0x434c, code: 0x3f, from: 0xf5021, to: 0xf6f3d},
+ 105: {region: 0x434c, code: 0x8040, from: 0x0, to: 0x0},
+ 106: {region: 0x434d, code: 0x109, from: 0xf6a81, to: 0x0},
+ 107: {region: 0x434e, code: 0x44, from: 0xf4261, to: 0x0},
+ 108: {region: 0x434e, code: 0x8043, from: 0xf7621, to: 0xf9d9f},
+ 109: {region: 0x434e, code: 0x8042, from: 0xfb4f3, to: 0x0},
+ 110: {region: 0x434f, code: 0x45, from: 0xee221, to: 0x0},
+ 111: {region: 0x434f, code: 0x8046, from: 0x0, to: 0x0},
+ 112: {region: 0x4350, code: 0x811d, from: 0x0, to: 0x0},
+ 113: {region: 0x4352, code: 0x47, from: 0xed15a, to: 0x0},
+ 114: {region: 0x4353, code: 0x48, from: 0xfa4af, to: 0xfacc3},
+ 115: {region: 0x4353, code: 0x5e, from: 0xfa644, to: 0xfacc3},
+ 116: {region: 0x4353, code: 0x121, from: 0xf9438, to: 0xfa4af},
+ 117: {region: 0x4355, code: 0x4b, from: 0xe8621, to: 0x0},
+ 118: {region: 0x4355, code: 0x4a, from: 0xf9421, to: 0x0},
+ 119: {region: 0x4355, code: 0xfc, from: 0xed621, to: 0xf4e21},
+ 120: {region: 0x4356, code: 0x4c, from: 0xef421, to: 0x0},
+ 121: {region: 0x4356, code: 0xcb, from: 0xeeeb6, to: 0xf6ee5},
+ 122: {region: 0x4357, code: 0x8, from: 0xfb54a, to: 0x0},
+ 123: {region: 0x4358, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 124: {region: 0x4359, code: 0x5e, from: 0xfb021, to: 0x0},
+ 125: {region: 0x4359, code: 0x4d, from: 0xef52a, to: 0xfb03f},
+ 126: {region: 0x435a, code: 0x4e, from: 0xf9221, to: 0x0},
+ 127: {region: 0x435a, code: 0x49, from: 0xf42c1, to: 0xf9261},
+ 128: {region: 0x4444, code: 0x4f, from: 0xf38f4, to: 0xf8d42},
+ 129: {region: 0x4445, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 130: {region: 0x4445, code: 0x50, from: 0xf38d4, to: 0xfa45c},
+ 131: {region: 0x4447, code: 0xfc, from: 0xf5b68, to: 0x0},
+ 132: {region: 0x444a, code: 0x51, from: 0xf72db, to: 0x0},
+ 133: {region: 0x444b, code: 0x52, from: 0xea2bb, to: 0x0},
+ 134: {region: 0x444d, code: 0x110, from: 0xf5b46, to: 0x0},
+ 135: {region: 0x444f, code: 0x53, from: 0xf3741, to: 0x0},
+ 136: {region: 0x444f, code: 0xfc, from: 0xee2d5, to: 0xf3741},
+ 137: {region: 0x445a, code: 0x54, from: 0xf5881, to: 0x0},
+ 138: {region: 0x4541, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 139: {region: 0x4543, code: 0xfc, from: 0xfa142, to: 0x0},
+ 140: {region: 0x4543, code: 0x55, from: 0xeb881, to: 0xfa142},
+ 141: {region: 0x4543, code: 0x8056, from: 0xf92b7, to: 0xfa029},
+ 142: {region: 0x4545, code: 0x5e, from: 0xfb621, to: 0x0},
+ 143: {region: 0x4545, code: 0x57, from: 0xf90d5, to: 0xfb59f},
+ 144: {region: 0x4545, code: 0xe7, from: 0xf5221, to: 0xf90d4},
+ 145: {region: 0x4547, code: 0x58, from: 0xebb6e, to: 0x0},
+ 146: {region: 0x4548, code: 0x9e, from: 0xf705a, to: 0x0},
+ 147: {region: 0x4552, code: 0x59, from: 0xf9b68, to: 0x0},
+ 148: {region: 0x4552, code: 0x5d, from: 0xf92b8, to: 0xf9b68},
+ 149: {region: 0x4553, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 150: {region: 0x4553, code: 0x5c, from: 0xe9953, to: 0xfa45c},
+ 151: {region: 0x4553, code: 0x805a, from: 0xf7421, to: 0xf7b9f},
+ 152: {region: 0x4553, code: 0x805b, from: 0xf6e21, to: 0xf959f},
+ 153: {region: 0x4554, code: 0x5d, from: 0xf712f, to: 0x0},
+ 154: {region: 0x4555, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 155: {region: 0x4555, code: 0x8112, from: 0xf7621, to: 0xf9d9f},
+ 156: {region: 0x4649, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 157: {region: 0x4649, code: 0x5f, from: 0xf5621, to: 0xfa45c},
+ 158: {region: 0x464a, code: 0x60, from: 0xf622d, to: 0x0},
+ 159: {region: 0x464b, code: 0x61, from: 0xeda21, to: 0x0},
+ 160: {region: 0x464d, code: 0xfc, from: 0xf3021, to: 0x0},
+ 161: {region: 0x464d, code: 0x85, from: 0xef543, to: 0xf3021},
+ 162: {region: 0x464f, code: 0x52, from: 0xf3821, to: 0x0},
+ 163: {region: 0x4652, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 164: {region: 0x4652, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 165: {region: 0x4741, code: 0x109, from: 0xf9221, to: 0x0},
+ 166: {region: 0x4742, code: 0x63, from: 0xd3cfb, to: 0x0},
+ 167: {region: 0x4744, code: 0x110, from: 0xf5e5b, to: 0x0},
+ 168: {region: 0x4745, code: 0x65, from: 0xf9737, to: 0x0},
+ 169: {region: 0x4745, code: 0x64, from: 0xf9285, to: 0xf9739},
+ 170: {region: 0x4745, code: 0xd3, from: 0xf8f99, to: 0xf92cb},
+ 171: {region: 0x4745, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 172: {region: 0x4746, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 173: {region: 0x4746, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 174: {region: 0x4747, code: 0x63, from: 0xe4c21, to: 0x0},
+ 175: {region: 0x4748, code: 0x67, from: 0xfaee3, to: 0x0},
+ 176: {region: 0x4748, code: 0x66, from: 0xf7669, to: 0xfaf9f},
+ 177: {region: 0x4749, code: 0x68, from: 0xd6221, to: 0x0},
+ 178: {region: 0x474c, code: 0x52, from: 0xea2bb, to: 0x0},
+ 179: {region: 0x474d, code: 0x69, from: 0xf66e1, to: 0x0},
+ 180: {region: 0x474e, code: 0x6a, from: 0xf8426, to: 0x0},
+ 181: {region: 0x474e, code: 0x6b, from: 0xf6942, to: 0xf8426},
+ 182: {region: 0x4750, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 183: {region: 0x4750, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 184: {region: 0x4751, code: 0x109, from: 0xf9221, to: 0x0},
+ 185: {region: 0x4751, code: 0x6c, from: 0xf6ee7, to: 0xf84c1},
+ 186: {region: 0x4752, code: 0x5e, from: 0xfa221, to: 0x0},
+ 187: {region: 0x4752, code: 0x6d, from: 0xf44a1, to: 0xfa45c},
+ 188: {region: 0x4753, code: 0x63, from: 0xee821, to: 0x0},
+ 189: {region: 0x4754, code: 0x6e, from: 0xf0abb, to: 0x0},
+ 190: {region: 0x4755, code: 0xfc, from: 0xf3115, to: 0x0},
+ 191: {region: 0x4757, code: 0x115, from: 0xf9a7f, to: 0x0},
+ 192: {region: 0x4757, code: 0x70, from: 0xf705c, to: 0xf9a7f},
+ 193: {region: 0x4757, code: 0x6f, from: 0xef421, to: 0xf705c},
+ 194: {region: 0x4759, code: 0x71, from: 0xf5cba, to: 0x0},
+ 195: {region: 0x484b, code: 0x72, from: 0xece42, to: 0x0},
+ 196: {region: 0x484d, code: 0x13, from: 0xf5e50, to: 0x0},
+ 197: {region: 0x484e, code: 0x73, from: 0xf0c83, to: 0x0},
+ 198: {region: 0x4852, code: 0x75, from: 0xf94be, to: 0x0},
+ 199: {region: 0x4852, code: 0x74, from: 0xf8f97, to: 0xf9621},
+ 200: {region: 0x4852, code: 0x122, from: 0xf8c21, to: 0xf8f97},
+ 201: {region: 0x4852, code: 0x120, from: 0xf5c21, to: 0xf8c21},
+ 202: {region: 0x4854, code: 0x76, from: 0xea11a, to: 0x0},
+ 203: {region: 0x4854, code: 0xfc, from: 0xef621, to: 0x0},
+ 204: {region: 0x4855, code: 0x77, from: 0xf34f7, to: 0x0},
+ 205: {region: 0x4943, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 206: {region: 0x4944, code: 0x78, from: 0xf5b8d, to: 0x0},
+ 207: {region: 0x4945, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 208: {region: 0x4945, code: 0x79, from: 0xf0421, to: 0xfa449},
+ 209: {region: 0x4945, code: 0x63, from: 0xe1021, to: 0xf0421},
+ 210: {region: 0x494c, code: 0x7c, from: 0xf8324, to: 0x0},
+ 211: {region: 0x494c, code: 0x7b, from: 0xf7856, to: 0xf8324},
+ 212: {region: 0x494c, code: 0x7a, from: 0xf3910, to: 0xf7856},
+ 213: {region: 0x494d, code: 0x63, from: 0xe6023, to: 0x0},
+ 214: {region: 0x494e, code: 0x7d, from: 0xe5711, to: 0x0},
+ 215: {region: 0x494f, code: 0xfc, from: 0xf5b68, to: 0x0},
+ 216: {region: 0x4951, code: 0x7e, from: 0xf1693, to: 0x0},
+ 217: {region: 0x4951, code: 0x58, from: 0xf016b, to: 0xf1693},
+ 218: {region: 0x4951, code: 0x7d, from: 0xf016b, to: 0xf1693},
+ 219: {region: 0x4952, code: 0x7f, from: 0xf18ad, to: 0x0},
+ 220: {region: 0x4953, code: 0x81, from: 0xf7a21, to: 0x0},
+ 221: {region: 0x4953, code: 0x80, from: 0xefd81, to: 0xf7a21},
+ 222: {region: 0x4953, code: 0x52, from: 0xea2bb, to: 0xefd81},
+ 223: {region: 0x4954, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 224: {region: 0x4954, code: 0x82, from: 0xe8d18, to: 0xfa45c},
+ 225: {region: 0x4a45, code: 0x63, from: 0xe5a21, to: 0x0},
+ 226: {region: 0x4a4d, code: 0x83, from: 0xf6328, to: 0x0},
+ 227: {region: 0x4a4f, code: 0x84, from: 0xf3ce1, to: 0x0},
+ 228: {region: 0x4a50, code: 0x85, from: 0xe9ec1, to: 0x0},
+ 229: {region: 0x4b45, code: 0x86, from: 0xf5d2e, to: 0x0},
+ 230: {region: 0x4b47, code: 0x87, from: 0xf92aa, to: 0x0},
+ 231: {region: 0x4b47, code: 0xd3, from: 0xf8f99, to: 0xf92aa},
+ 232: {region: 0x4b47, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 233: {region: 0x4b48, code: 0x88, from: 0xf7874, to: 0x0},
+ 234: {region: 0x4b49, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 235: {region: 0x4b4d, code: 0x89, from: 0xf6ee6, to: 0x0},
+ 236: {region: 0x4b4e, code: 0x110, from: 0xf5b46, to: 0x0},
+ 237: {region: 0x4b50, code: 0x8a, from: 0xf4e91, to: 0x0},
+ 238: {region: 0x4b52, code: 0x8d, from: 0xf54ca, to: 0x0},
+ 239: {region: 0x4b52, code: 0x8b, from: 0xf424f, to: 0xf54ca},
+ 240: {region: 0x4b52, code: 0x8c, from: 0xf330f, to: 0xf424f},
+ 241: {region: 0x4b57, code: 0x8e, from: 0xf5281, to: 0x0},
+ 242: {region: 0x4b59, code: 0x8f, from: 0xf6621, to: 0x0},
+ 243: {region: 0x4b59, code: 0x83, from: 0xf6328, to: 0xf6621},
+ 244: {region: 0x4b5a, code: 0x90, from: 0xf9365, to: 0x0},
+ 245: {region: 0x4c41, code: 0x91, from: 0xf778a, to: 0x0},
+ 246: {region: 0x4c42, code: 0x92, from: 0xf3842, to: 0x0},
+ 247: {region: 0x4c43, code: 0x110, from: 0xf5b46, to: 0x0},
+ 248: {region: 0x4c49, code: 0x3d, from: 0xf0241, to: 0x0},
+ 249: {region: 0x4c4b, code: 0x93, from: 0xf74b6, to: 0x0},
+ 250: {region: 0x4c52, code: 0x94, from: 0xf3021, to: 0x0},
+ 251: {region: 0x4c53, code: 0x125, from: 0xf524e, to: 0x0},
+ 252: {region: 0x4c53, code: 0x95, from: 0xf7836, to: 0x0},
+ 253: {region: 0x4c54, code: 0x5e, from: 0xfbe21, to: 0x0},
+ 254: {region: 0x4c54, code: 0x96, from: 0xf92d9, to: 0xfbd9f},
+ 255: {region: 0x4c54, code: 0x97, from: 0xf9141, to: 0xf92d9},
+ 256: {region: 0x4c54, code: 0xe7, from: 0xf5221, to: 0xf9141},
+ 257: {region: 0x4c55, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 258: {region: 0x4c55, code: 0x99, from: 0xf3124, to: 0xfa45c},
+ 259: {region: 0x4c55, code: 0x8098, from: 0xf6421, to: 0xf8c65},
+ 260: {region: 0x4c55, code: 0x809a, from: 0xf6421, to: 0xf8c65},
+ 261: {region: 0x4c56, code: 0x5e, from: 0xfbc21, to: 0x0},
+ 262: {region: 0x4c56, code: 0x9b, from: 0xf92dc, to: 0xfbb9f},
+ 263: {region: 0x4c56, code: 0x9c, from: 0xf90a7, to: 0xf9351},
+ 264: {region: 0x4c56, code: 0xe7, from: 0xf5221, to: 0xf90f4},
+ 265: {region: 0x4c59, code: 0x9d, from: 0xf6721, to: 0x0},
+ 266: {region: 0x4d41, code: 0x9e, from: 0xf4f51, to: 0x0},
+ 267: {region: 0x4d41, code: 0x9f, from: 0xeb221, to: 0xf4f51},
+ 268: {region: 0x4d43, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 269: {region: 0x4d43, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 270: {region: 0x4d43, code: 0xa0, from: 0xf5021, to: 0xfa451},
+ 271: {region: 0x4d44, code: 0xa2, from: 0xf937d, to: 0x0},
+ 272: {region: 0x4d44, code: 0xa1, from: 0xf90c1, to: 0xf937d},
+ 273: {region: 0x4d45, code: 0x5e, from: 0xfa421, to: 0x0},
+ 274: {region: 0x4d45, code: 0x50, from: 0xf9f42, to: 0xfa4af},
+ 275: {region: 0x4d45, code: 0x121, from: 0xf9438, to: 0xfa4af},
+ 276: {region: 0x4d46, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 277: {region: 0x4d46, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 278: {region: 0x4d47, code: 0xa3, from: 0xf7f61, to: 0x0},
+ 279: {region: 0x4d47, code: 0xa4, from: 0xf56e1, to: 0xfa99f},
+ 280: {region: 0x4d48, code: 0xfc, from: 0xf3021, to: 0x0},
+ 281: {region: 0x4d4b, code: 0xa5, from: 0xf92b4, to: 0x0},
+ 282: {region: 0x4d4b, code: 0xa6, from: 0xf909a, to: 0xf92b4},
+ 283: {region: 0x4d4c, code: 0x115, from: 0xf80c1, to: 0x0},
+ 284: {region: 0x4d4c, code: 0xa7, from: 0xf54e2, to: 0xf811f},
+ 285: {region: 0x4d4c, code: 0x115, from: 0xf4d78, to: 0xf54e2},
+ 286: {region: 0x4d4d, code: 0xa8, from: 0xf8ad2, to: 0x0},
+ 287: {region: 0x4d4d, code: 0x34, from: 0xf40e1, to: 0xf8ad2},
+ 288: {region: 0x4d4e, code: 0xa9, from: 0xef661, to: 0x0},
+ 289: {region: 0x4d4f, code: 0xaa, from: 0xeda21, to: 0x0},
+ 290: {region: 0x4d50, code: 0xfc, from: 0xf3021, to: 0x0},
+ 291: {region: 0x4d51, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 292: {region: 0x4d51, code: 0x62, from: 0xf5021, to: 0xfa451},
+ 293: {region: 0x4d52, code: 0xab, from: 0xf6add, to: 0x0},
+ 294: {region: 0x4d52, code: 0x115, from: 0xf4d7c, to: 0xf6add},
+ 295: {region: 0x4d53, code: 0x110, from: 0xf5e5b, to: 0x0},
+ 296: {region: 0x4d54, code: 0x5e, from: 0xfb021, to: 0x0},
+ 297: {region: 0x4d54, code: 0xac, from: 0xf60c7, to: 0xfb03f},
+ 298: {region: 0x4d54, code: 0xad, from: 0xef50d, to: 0xf60c7},
+ 299: {region: 0x4d55, code: 0xae, from: 0xf1c81, to: 0x0},
+ 300: {region: 0x4d56, code: 0xb0, from: 0xf7ae1, to: 0x0},
+ 301: {region: 0x4d57, code: 0xb1, from: 0xf664f, to: 0x0},
+ 302: {region: 0x4d58, code: 0xb2, from: 0xf9221, to: 0x0},
+ 303: {region: 0x4d58, code: 0xb3, from: 0xe3c21, to: 0xf919f},
+ 304: {region: 0x4d58, code: 0x80b4, from: 0x0, to: 0x0},
+ 305: {region: 0x4d59, code: 0xb5, from: 0xf5730, to: 0x0},
+ 306: {region: 0x4d5a, code: 0xb8, from: 0xface1, to: 0x0},
+ 307: {region: 0x4d5a, code: 0xb7, from: 0xf78d0, to: 0xfad9f},
+ 308: {region: 0x4d5a, code: 0xb6, from: 0xf6ed9, to: 0xf78d0},
+ 309: {region: 0x4e41, code: 0xb9, from: 0xf9221, to: 0x0},
+ 310: {region: 0x4e41, code: 0x125, from: 0xf524e, to: 0x0},
+ 311: {region: 0x4e43, code: 0x117, from: 0xf8221, to: 0x0},
+ 312: {region: 0x4e45, code: 0x115, from: 0xf4d93, to: 0x0},
+ 313: {region: 0x4e46, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 314: {region: 0x4e47, code: 0xba, from: 0xf6a21, to: 0x0},
+ 315: {region: 0x4e49, code: 0xbc, from: 0xf8e9e, to: 0x0},
+ 316: {region: 0x4e49, code: 0xbb, from: 0xf884f, to: 0xf8e9e},
+ 317: {region: 0x4e4c, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 318: {region: 0x4e4c, code: 0xbd, from: 0xe2a21, to: 0xfa45c},
+ 319: {region: 0x4e4f, code: 0xbe, from: 0xee2c7, to: 0x0},
+ 320: {region: 0x4e4f, code: 0xdb, from: 0xea2bb, to: 0xee2c7},
+ 321: {region: 0x4e50, code: 0xbf, from: 0xf1a21, to: 0x0},
+ 322: {region: 0x4e50, code: 0x7d, from: 0xe9c21, to: 0xf5d51},
+ 323: {region: 0x4e52, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 324: {region: 0x4e55, code: 0xc0, from: 0xf5eea, to: 0x0},
+ 325: {region: 0x4e5a, code: 0xc0, from: 0xf5eea, to: 0x0},
+ 326: {region: 0x4f4d, code: 0xc1, from: 0xf696b, to: 0x0},
+ 327: {region: 0x5041, code: 0xc2, from: 0xedf64, to: 0x0},
+ 328: {region: 0x5041, code: 0xfc, from: 0xedf72, to: 0x0},
+ 329: {region: 0x5045, code: 0xc4, from: 0xf8ee1, to: 0x0},
+ 330: {region: 0x5045, code: 0xc3, from: 0xf8241, to: 0xf8ee1},
+ 331: {region: 0x5045, code: 0xc5, from: 0xe8e4e, to: 0xf8241},
+ 332: {region: 0x5046, code: 0x117, from: 0xf339a, to: 0x0},
+ 333: {region: 0x5047, code: 0xc6, from: 0xf6f30, to: 0x0},
+ 334: {region: 0x5047, code: 0x13, from: 0xf5c4e, to: 0xf6f30},
+ 335: {region: 0x5048, code: 0xc7, from: 0xf34e4, to: 0x0},
+ 336: {region: 0x504b, code: 0xc8, from: 0xf3881, to: 0x0},
+ 337: {region: 0x504b, code: 0x7d, from: 0xe5711, to: 0xf370f},
+ 338: {region: 0x504c, code: 0xc9, from: 0xf9621, to: 0x0},
+ 339: {region: 0x504c, code: 0xca, from: 0xf3d5c, to: 0xf959f},
+ 340: {region: 0x504d, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 341: {region: 0x504d, code: 0x62, from: 0xf6995, to: 0xfa451},
+ 342: {region: 0x504e, code: 0xc0, from: 0xf622d, to: 0x0},
+ 343: {region: 0x5052, code: 0xfc, from: 0xed58a, to: 0x0},
+ 344: {region: 0x5052, code: 0x5c, from: 0xe1021, to: 0xed58a},
+ 345: {region: 0x5053, code: 0x7c, from: 0xf8324, to: 0x0},
+ 346: {region: 0x5053, code: 0x84, from: 0xf984c, to: 0x0},
+ 347: {region: 0x5053, code: 0x7a, from: 0xf5ec1, to: 0xf7856},
+ 348: {region: 0x5053, code: 0x84, from: 0xf3ce1, to: 0xf5ec1},
+ 349: {region: 0x5054, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 350: {region: 0x5054, code: 0xcb, from: 0xeeeb6, to: 0xfa45c},
+ 351: {region: 0x5057, code: 0xfc, from: 0xf3021, to: 0x0},
+ 352: {region: 0x5059, code: 0xcc, from: 0xf2f61, to: 0x0},
+ 353: {region: 0x5141, code: 0xcd, from: 0xf6ab3, to: 0x0},
+ 354: {region: 0x5245, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 355: {region: 0x5245, code: 0x62, from: 0xf6e21, to: 0xfa451},
+ 356: {region: 0x524f, code: 0xd0, from: 0xfaae1, to: 0x0},
+ 357: {region: 0x524f, code: 0xcf, from: 0xf403c, to: 0xfad9f},
+ 358: {region: 0x5253, code: 0xd1, from: 0xfad59, to: 0x0},
+ 359: {region: 0x5253, code: 0x48, from: 0xfa4af, to: 0xfad59},
+ 360: {region: 0x5253, code: 0x121, from: 0xf9438, to: 0xfa4af},
+ 361: {region: 0x5255, code: 0xd2, from: 0xf9e21, to: 0x0},
+ 362: {region: 0x5255, code: 0xd3, from: 0xf8f99, to: 0xf9d9f},
+ 363: {region: 0x5257, code: 0xd4, from: 0xf58b3, to: 0x0},
+ 364: {region: 0x5341, code: 0xd5, from: 0xf4156, to: 0x0},
+ 365: {region: 0x5342, code: 0xd6, from: 0xf7358, to: 0x0},
+ 366: {region: 0x5342, code: 0x13, from: 0xf5c4e, to: 0xf74de},
+ 367: {region: 0x5343, code: 0xd7, from: 0xedf61, to: 0x0},
+ 368: {region: 0x5344, code: 0xd9, from: 0xfae2a, to: 0x0},
+ 369: {region: 0x5344, code: 0xd8, from: 0xf90c8, to: 0xfaede},
+ 370: {region: 0x5344, code: 0xda, from: 0xf4a88, to: 0xf9cc1},
+ 371: {region: 0x5344, code: 0x58, from: 0xec233, to: 0xf4c21},
+ 372: {region: 0x5344, code: 0x63, from: 0xec233, to: 0xf4c21},
+ 373: {region: 0x5345, code: 0xdb, from: 0xea2bb, to: 0x0},
+ 374: {region: 0x5347, code: 0xdc, from: 0xf5ecc, to: 0x0},
+ 375: {region: 0x5347, code: 0xb5, from: 0xf5730, to: 0xf5ecc},
+ 376: {region: 0x5348, code: 0xdd, from: 0xefa4f, to: 0x0},
+ 377: {region: 0x5349, code: 0x5e, from: 0xfae21, to: 0x0},
+ 378: {region: 0x5349, code: 0xde, from: 0xf9147, to: 0xfae2e},
+ 379: {region: 0x534a, code: 0xbe, from: 0xee2c7, to: 0x0},
+ 380: {region: 0x534b, code: 0x5e, from: 0xfb221, to: 0x0},
+ 381: {region: 0x534b, code: 0xdf, from: 0xf919f, to: 0xfb221},
+ 382: {region: 0x534b, code: 0x49, from: 0xf42c1, to: 0xf919f},
+ 383: {region: 0x534c, code: 0xe0, from: 0xf5904, to: 0x0},
+ 384: {region: 0x534c, code: 0x63, from: 0xe217e, to: 0xf5c44},
+ 385: {region: 0x534d, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 386: {region: 0x534d, code: 0x82, from: 0xe9397, to: 0xfa25c},
+ 387: {region: 0x534e, code: 0x115, from: 0xf4e84, to: 0x0},
+ 388: {region: 0x534f, code: 0xe1, from: 0xf50e1, to: 0x0},
+ 389: {region: 0x5352, code: 0xe2, from: 0xfa821, to: 0x0},
+ 390: {region: 0x5352, code: 0xe3, from: 0xf28aa, to: 0xfa79f},
+ 391: {region: 0x5352, code: 0xbd, from: 0xe2f74, to: 0xf28aa},
+ 392: {region: 0x5353, code: 0xe4, from: 0xfb6f2, to: 0x0},
+ 393: {region: 0x5353, code: 0xd9, from: 0xfae2a, to: 0xfb721},
+ 394: {region: 0x5354, code: 0xe6, from: 0xfc421, to: 0x0},
+ 395: {region: 0x5354, code: 0xe5, from: 0xf7328, to: 0xfc39f},
+ 396: {region: 0x5355, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 397: {region: 0x5356, code: 0xfc, from: 0xfa221, to: 0x0},
+ 398: {region: 0x5356, code: 0xe8, from: 0xeff6b, to: 0xfa221},
+ 399: {region: 0x5358, code: 0x8, from: 0xfb54a, to: 0x0},
+ 400: {region: 0x5359, code: 0xe9, from: 0xf3821, to: 0x0},
+ 401: {region: 0x535a, code: 0xea, from: 0xf6d26, to: 0x0},
+ 402: {region: 0x5441, code: 0x63, from: 0xf242c, to: 0x0},
+ 403: {region: 0x5443, code: 0xfc, from: 0xf6328, to: 0x0},
+ 404: {region: 0x5444, code: 0x109, from: 0xf9221, to: 0x0},
+ 405: {region: 0x5446, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 406: {region: 0x5446, code: 0x62, from: 0xf4e21, to: 0xfa451},
+ 407: {region: 0x5447, code: 0x115, from: 0xf4d7c, to: 0x0},
+ 408: {region: 0x5448, code: 0xeb, from: 0xf108f, to: 0x0},
+ 409: {region: 0x544a, code: 0xed, from: 0xfa15a, to: 0x0},
+ 410: {region: 0x544a, code: 0xec, from: 0xf96aa, to: 0xfa159},
+ 411: {region: 0x544a, code: 0xd3, from: 0xf8f99, to: 0xf96aa},
+ 412: {region: 0x544b, code: 0xc0, from: 0xf5eea, to: 0x0},
+ 413: {region: 0x544c, code: 0xfc, from: 0xf9f54, to: 0x0},
+ 414: {region: 0x544c, code: 0xf2, from: 0xf4e22, to: 0xfa4b4},
+ 415: {region: 0x544c, code: 0x78, from: 0xf6f87, to: 0xfa4b4},
+ 416: {region: 0x544d, code: 0xef, from: 0xfb221, to: 0x0},
+ 417: {region: 0x544d, code: 0xee, from: 0xf9361, to: 0xfb221},
+ 418: {region: 0x544d, code: 0xd3, from: 0xf8f99, to: 0xf9361},
+ 419: {region: 0x544d, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 420: {region: 0x544e, code: 0xf0, from: 0xf4d61, to: 0x0},
+ 421: {region: 0x544f, code: 0xf1, from: 0xf5c4e, to: 0x0},
+ 422: {region: 0x5450, code: 0xf2, from: 0xf4e22, to: 0xfa4b4},
+ 423: {region: 0x5450, code: 0x78, from: 0xf6f87, to: 0xfa4b4},
+ 424: {region: 0x5452, code: 0xf4, from: 0xfaa21, to: 0x0},
+ 425: {region: 0x5452, code: 0xf3, from: 0xf0561, to: 0xfab9f},
+ 426: {region: 0x5454, code: 0xf5, from: 0xf5821, to: 0x0},
+ 427: {region: 0x5456, code: 0x13, from: 0xf5c4e, to: 0x0},
+ 428: {region: 0x5457, code: 0xf6, from: 0xf3acf, to: 0x0},
+ 429: {region: 0x545a, code: 0xf7, from: 0xf5cce, to: 0x0},
+ 430: {region: 0x5541, code: 0xf8, from: 0xf9922, to: 0x0},
+ 431: {region: 0x5541, code: 0xf9, from: 0xf916d, to: 0xf9351},
+ 432: {region: 0x5541, code: 0xd3, from: 0xf8f99, to: 0xf916d},
+ 433: {region: 0x5541, code: 0xe7, from: 0xf5221, to: 0xf8f99},
+ 434: {region: 0x5547, code: 0xfb, from: 0xf86af, to: 0x0},
+ 435: {region: 0x5547, code: 0xfa, from: 0xf5d0f, to: 0xf86af},
+ 436: {region: 0x554d, code: 0xfc, from: 0xf3021, to: 0x0},
+ 437: {region: 0x5553, code: 0xfc, from: 0xe0021, to: 0x0},
+ 438: {region: 0x5553, code: 0x80fd, from: 0x0, to: 0x0},
+ 439: {region: 0x5553, code: 0x80fe, from: 0x0, to: 0xfbc61},
+ 440: {region: 0x5559, code: 0x101, from: 0xf9261, to: 0x0},
+ 441: {region: 0x5559, code: 0x100, from: 0xf6ee1, to: 0xf9261},
+ 442: {region: 0x5559, code: 0x80ff, from: 0x0, to: 0x0},
+ 443: {region: 0x555a, code: 0x102, from: 0xf94e1, to: 0x0},
+ 444: {region: 0x5641, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 445: {region: 0x5641, code: 0x82, from: 0xe9d53, to: 0xfa45c},
+ 446: {region: 0x5643, code: 0x110, from: 0xf5b46, to: 0x0},
+ 447: {region: 0x5645, code: 0x104, from: 0xfb021, to: 0x0},
+ 448: {region: 0x5645, code: 0x103, from: 0xe9eab, to: 0xfb0de},
+ 449: {region: 0x5647, code: 0xfc, from: 0xe5221, to: 0x0},
+ 450: {region: 0x5647, code: 0x63, from: 0xe5221, to: 0xf4e21},
+ 451: {region: 0x5649, code: 0xfc, from: 0xe5a21, to: 0x0},
+ 452: {region: 0x564e, code: 0x105, from: 0xf832e, to: 0x0},
+ 453: {region: 0x564e, code: 0x106, from: 0xf74a3, to: 0xf832e},
+ 454: {region: 0x5655, code: 0x107, from: 0xf7a21, to: 0x0},
+ 455: {region: 0x5746, code: 0x117, from: 0xf52fe, to: 0x0},
+ 456: {region: 0x5753, code: 0x108, from: 0xf5eea, to: 0x0},
+ 457: {region: 0x584b, code: 0x5e, from: 0xfa421, to: 0x0},
+ 458: {region: 0x584b, code: 0x50, from: 0xf9f21, to: 0xfa469},
+ 459: {region: 0x584b, code: 0x121, from: 0xf9438, to: 0xf9f3e},
+ 460: {region: 0x5944, code: 0x11e, from: 0xf5a81, to: 0xf9821},
+ 461: {region: 0x5945, code: 0x11f, from: 0xf8cb6, to: 0x0},
+ 462: {region: 0x5954, code: 0x5e, from: 0xf9e21, to: 0x0},
+ 463: {region: 0x5954, code: 0x62, from: 0xf7057, to: 0xfa451},
+ 464: {region: 0x5954, code: 0x89, from: 0xf6e21, to: 0xf7057},
+ 465: {region: 0x5955, code: 0x121, from: 0xf9438, to: 0xfa4af},
+ 466: {region: 0x5955, code: 0x122, from: 0xf8c21, to: 0xf90f8},
+ 467: {region: 0x5955, code: 0x120, from: 0xf5c21, to: 0xf8c21},
+ 468: {region: 0x5a41, code: 0x125, from: 0xf524e, to: 0x0},
+ 469: {region: 0x5a41, code: 0x8124, from: 0xf8321, to: 0xf966d},
+ 470: {region: 0x5a4d, code: 0x127, from: 0xfba21, to: 0x0},
+ 471: {region: 0x5a4d, code: 0x126, from: 0xf6030, to: 0xfba21},
+ 472: {region: 0x5a52, code: 0x128, from: 0xf9361, to: 0xf9cff},
+ 473: {region: 0x5a52, code: 0x129, from: 0xf675b, to: 0xf9361},
+ 474: {region: 0x5a57, code: 0xfc, from: 0xfb28c, to: 0x0},
+ 475: {region: 0x5a57, code: 0x12b, from: 0xfb242, to: 0xfb28c},
+ 476: {region: 0x5a57, code: 0x12c, from: 0xfb101, to: 0xfb242},
+ 477: {region: 0x5a57, code: 0x12a, from: 0xf7892, to: 0xfb101},
+ 478: {region: 0x5a57, code: 0xce, from: 0xf6451, to: 0xf7892},
+ 479: {region: 0x5a5a, code: 0x810a, from: 0x0, to: 0x0},
+ 480: {region: 0x5a5a, code: 0x810b, from: 0x0, to: 0x0},
+ 481: {region: 0x5a5a, code: 0x810c, from: 0x0, to: 0x0},
+ 482: {region: 0x5a5a, code: 0x810d, from: 0x0, to: 0x0},
+ 483: {region: 0x5a5a, code: 0x810e, from: 0x0, to: 0x0},
+ 484: {region: 0x5a5a, code: 0x810f, from: 0x0, to: 0x0},
+ 485: {region: 0x5a5a, code: 0x8111, from: 0x0, to: 0x0},
+ 486: {region: 0x5a5a, code: 0x8113, from: 0xf1421, to: 0xfa681},
+ 487: {region: 0x5a5a, code: 0x8114, from: 0x0, to: 0xfbb7e},
+ 488: {region: 0x5a5a, code: 0x8116, from: 0x0, to: 0x0},
+ 489: {region: 0x5a5a, code: 0x8118, from: 0x0, to: 0x0},
+ 490: {region: 0x5a5a, code: 0x8119, from: 0x0, to: 0xf9f7e},
+ 491: {region: 0x5a5a, code: 0x811a, from: 0x0, to: 0x0},
+ 492: {region: 0x5a5a, code: 0x811b, from: 0x0, to: 0x0},
+ 493: {region: 0x5a5a, code: 0x811c, from: 0x0, to: 0x0},
+ 494: {region: 0x5a5a, code: 0x811d, from: 0x0, to: 0x0},
+} // Size: 5964 bytes
+
+// symbols holds symbol data of the form , where n is the length of
+// the symbol string str.
+const symbols string = "" + // Size: 1445 bytes
+ "\x00\x02Kz\x01$\x02A$\x02KM\x03৳\x02Bs\x02R$\x01P\x03р.\x03CA$\x04CN¥" +
+ "\x02¥\x03₡\x03Kč\x02kr\x03E£\x03₧\x03€\x02£\x03₾\x02FG\x01Q\x03HK$\x01L" +
+ "\x02kn\x02Ft\x02Rp\x03₪\x03₹\x04JP¥\x03៛\x02CF\x03₩\x03₸\x03₭\x03L£\x02R" +
+ "s\x02Lt\x02Ls\x02Ar\x01K\x03₮\x03MX$\x02RM\x03₦\x02C$\x03NZ$\x03₱\x03zł" +
+ "\x03₲\x03lei\x03₽\x02RF\x02Db\x03฿\x02T$\x03₺\x03NT$\x03₴\x03US$\x03₫" +
+ "\x04FCFA\x03EC$\x03CFA\x04CFPF\x01R\x02ZK\x03leu\x05GH₵\x03AU$\x16የቻይና ዩ" +
+ "ዋን\x06ብር\x03***\x09د.إ.\u200f\x03AR$\x03BB$\x09د.ب.\u200f\x03BM$\x03BN" +
+ "$\x03BS$\x03BZ$\x03CL$\x03CO$\x03CU$\x03DO$\x09د.ج.\u200f\x09ج.م.\u200f" +
+ "\x03FJ$\x04UK£\x03GY$\x09د.ع.\u200f\x06ر.إ.\x03JM$\x09د.أ.\u200f\x09د.ك." +
+ "\u200f\x03KY$\x09ل.ل.\u200f\x09د.ل.\u200f\x09د.م.\u200f\x09أ.م.\u200f" +
+ "\x09ر.ع.\u200f\x09ر.ق.\u200f\x09ر.س.\u200f\x03SB$\x09د.س.\u200f\x06ج.س." +
+ "\x03SR$\x09ل.س.\u200f\x09د.ت.\u200f\x03TT$\x03UY$\x09ر.ي.\u200f\x03Fdj" +
+ "\x03Nfk\x01S\x04GB£\x03TSh\x03₼\x03ley\x03S£\x04Bds$\x03BD$\x02B$\x02Br" +
+ "\x04CUC$\x03$MN\x03RD$\x04FK£\x02G$\x04Íkr\x02J$\x03CI$\x02L$\x02N$\x07р" +
+ "уб.\x03SI$\x02S$\x02$U\x05лв.\x06щ.д.\x02$A\x03$CA\x04£ E\x05£ RU\x04$ " +
+ "HK\x03£L\x04$ ZN\x03$ T\x04$ SU\x04din.\x04КМ\x04Кч\x04зл\x07дин.\x04Тл" +
+ "\x01F\x06лей\x03USh\x04Kčs\x03ECU\x02TK\x03kr.\x03Ksh\x03öS\x03BGK\x03BG" +
+ "J\x04Cub$\x02DM\x04Fl£\x04F.G.\x02FC\x04F.Rw\x03Nu.\x05KR₩\x05TH฿\x06Δρχ" +
+ "\x02Tk\x02$b\x02Kr\x02Gs\x03CFP\x03FBu\x01D\x04MOP$\x02MK\x02SR\x02Le" +
+ "\x04NAf.\x01E\x02VT\x03WS$\x04SD£\x03BsF\x02p.\x03B/.\x02S/\x03Gs.\x03Bs" +
+ ".\x02؋\x04¥CN\x03$HK\x08ریال\x03$MX\x03$NZ\x03$EC\x02UM\x02mk\x03$AR\x03" +
+ "$AU\x02FB\x03$BM\x03$BN\x03$BS\x03$BZ\x03$CL\x03$CO\x04£CY\x03£E\x03$FJ" +
+ "\x04£FK\x04£GB\x04£GI\x04£IE\x04£IL\x05₤IT\x04£LB\x04£MT\x03$NA\x02$C" +
+ "\x03$RH\x02FR\x03$SB\x03$SG\x03$SR\x03$TT\x03$US\x03$UY\x04FCFP\x02Kw" +
+ "\x05$\u00a0AU\x05$\u00a0HK\x05$\u00a0NZ\x05$\u00a0SG\x05$\u00a0US\x02DA" +
+ "\x01G\x02LS\x02DT\x06руб\x07રૂ.\x0a\u200eCN¥\u200e\x06ל״י\x09लेई\x02֏" +
+ "\x03NKr\x03元\x03¥\x06レイ\x03\u200b\x06ಲೀ\x02LE\x02Kn\x06сом\x02zl\x02rb" +
+ "\x03MTn\x06ден\x04кр\x03NAf\x03Afl\x0cनेरू\x06रू\x04Afl.\x02ر\x03lej\x04" +
+ "Esc.\x06\u200bPTE\x04XXXX\x03ლ\x06ТМТ\x03Dkr\x03Skr\x03Nkr\x07රු.\x0fසිෆ" +
+ "්එ\x03NIS\x05Lekë\x03den\x02r.\x03BR$\x03Ekr\x04EG£\x04IE£\x03Ikr\x03R" +
+ "s.\x07сом.\x04AUD$\x04NZD$\x07крб.\x05soʻm\x06сўм\x03₩\x03ILS\x02P.\x03Z" +
+ "ł"
+
+type curToIndex struct {
+ cur uint16
+ idx uint16
+}
+
+var normalLangIndex = []uint16{ // 776 elements
+ // Entry 0 - 3F
+ 0x0000, 0x0014, 0x0017, 0x0018, 0x0018, 0x0018, 0x0018, 0x0019,
+ 0x0019, 0x001d, 0x001d, 0x0034, 0x0034, 0x0034, 0x0034, 0x0035,
+ 0x0035, 0x0035, 0x0035, 0x0036, 0x0036, 0x0036, 0x0036, 0x0037,
+ 0x0037, 0x0038, 0x0038, 0x0038, 0x0038, 0x0038, 0x0038, 0x0038,
+ 0x0038, 0x0038, 0x0039, 0x003b, 0x003b, 0x003b, 0x003b, 0x003b,
+ 0x003b, 0x003b, 0x003b, 0x003c, 0x003c, 0x003f, 0x003f, 0x0041,
+ 0x0042, 0x0042, 0x0042, 0x0042, 0x0042, 0x0042, 0x0049, 0x0049,
+ 0x004a, 0x004a, 0x004b, 0x004b, 0x005c, 0x005c, 0x005c, 0x005c,
+ // Entry 40 - 7F
+ 0x005c, 0x005e, 0x005e, 0x005e, 0x005f, 0x005f, 0x0060, 0x006e,
+ 0x006e, 0x006e, 0x006e, 0x007f, 0x0085, 0x0085, 0x0085, 0x0085,
+ 0x008e, 0x008e, 0x008e, 0x008f, 0x008f, 0x0091, 0x0091, 0x0091,
+ 0x0092, 0x0092, 0x0093, 0x0093, 0x0094, 0x0094, 0x0095, 0x0095,
+ 0x0095, 0x009c, 0x009c, 0x009d, 0x009d, 0x009f, 0x009f, 0x00a3,
+ 0x00a3, 0x00a3, 0x00a4, 0x00a4, 0x00ac, 0x00ac, 0x00ac, 0x00ad,
+ 0x00ad, 0x00ad, 0x00ae, 0x00af, 0x00af, 0x00af, 0x00b4, 0x00b4,
+ 0x00b4, 0x00b4, 0x00b4, 0x00b4, 0x00b4, 0x00ba, 0x00ba, 0x00bb,
+ // Entry 80 - BF
+ 0x00bb, 0x00be, 0x00be, 0x00be, 0x00c1, 0x00c1, 0x00c1, 0x00c3,
+ 0x00c5, 0x00c5, 0x00c6, 0x00c7, 0x00c7, 0x00c7, 0x00dc, 0x00dd,
+ 0x00dd, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4,
+ 0x00e4, 0x00e5, 0x00e5, 0x00e6, 0x00e6, 0x00e6, 0x00e6, 0x00e7,
+ 0x00e8, 0x00e9, 0x00e9, 0x00ea, 0x00ec, 0x00ec, 0x00ec, 0x00ed,
+ 0x00ed, 0x00ee, 0x00f0, 0x00f1, 0x00f1, 0x00f2, 0x00f2, 0x00f2,
+ 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f3, 0x00f4, 0x00f5,
+ 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fb, 0x00fc,
+ // Entry C0 - FF
+ 0x00fc, 0x00fd, 0x00fe, 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103,
+ 0x0104, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010a,
+ 0x010b, 0x010b, 0x010b, 0x010c, 0x010d, 0x010e, 0x010e, 0x010f,
+ 0x0110, 0x0112, 0x0112, 0x0113, 0x0115, 0x0116, 0x0117, 0x0117,
+ 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011d, 0x011d,
+ 0x011e, 0x011e, 0x011e, 0x011f, 0x0120, 0x0121, 0x0122, 0x0122,
+ 0x0122, 0x0122, 0x0133, 0x0138, 0x013a, 0x013b, 0x013c, 0x013d,
+ 0x013f, 0x0141, 0x0142, 0x0144, 0x0146, 0x0146, 0x0147, 0x0147,
+ // Entry 100 - 13F
+ 0x0148, 0x0149, 0x014a, 0x014a, 0x014b, 0x014c, 0x014d, 0x014e,
+ 0x014f, 0x0150, 0x0151, 0x0152, 0x0154, 0x0156, 0x0157, 0x015c,
+ 0x015c, 0x015e, 0x015e, 0x015e, 0x015e, 0x0169, 0x0169, 0x0169,
+ 0x0169, 0x0169, 0x016a, 0x016b, 0x016b, 0x017c, 0x017c, 0x0180,
+ 0x0180, 0x0181, 0x0182, 0x0182, 0x01a8, 0x01a8, 0x01a8, 0x01a9,
+ 0x01a9, 0x01a9, 0x01ca, 0x01cb, 0x01cb, 0x01cb, 0x01cb, 0x01cb,
+ 0x01cb, 0x01cc, 0x01cd, 0x01cd, 0x01cd, 0x01cd, 0x01ce, 0x01ce,
+ 0x01ce, 0x01cf, 0x01d0, 0x01d2, 0x01d2, 0x01d2, 0x01d2, 0x01d3,
+ // Entry 140 - 17F
+ 0x01d3, 0x01d3, 0x01d4, 0x01d5, 0x01d5, 0x01d5, 0x01d5, 0x01d5,
+ 0x01d5, 0x01d6, 0x01d7, 0x01d7, 0x01d8, 0x01d8, 0x01d8, 0x01d9,
+ 0x01da, 0x01da, 0x01da, 0x01da, 0x01da, 0x01e0, 0x01e0, 0x01e3,
+ 0x01e3, 0x01e5, 0x01e5, 0x01e9, 0x01e9, 0x01ec, 0x01ec, 0x01ec,
+ 0x01ec, 0x01ed, 0x01ed, 0x01ed, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
+ 0x01ef, 0x01f0, 0x01f0, 0x01f0, 0x01f1, 0x01f1, 0x01f6, 0x01f6,
+ 0x01f8, 0x01f8, 0x020a, 0x020b, 0x020b, 0x0210, 0x0210, 0x0222,
+ 0x0222, 0x0225, 0x0225, 0x0229, 0x0229, 0x022a, 0x022a, 0x022b,
+ // Entry 180 - 1BF
+ 0x022b, 0x022b, 0x022b, 0x0237, 0x0237, 0x023f, 0x023f, 0x023f,
+ 0x023f, 0x023f, 0x023f, 0x023f, 0x0242, 0x0242, 0x0242, 0x0242,
+ 0x0242, 0x0242, 0x0243, 0x0243, 0x0243, 0x0243, 0x024d, 0x024d,
+ 0x024e, 0x024e, 0x024e, 0x024f, 0x024f, 0x024f, 0x0250, 0x0250,
+ 0x0253, 0x0253, 0x0253, 0x0253, 0x0254, 0x0254, 0x0258, 0x0258,
+ 0x0258, 0x0258, 0x0259, 0x0259, 0x025a, 0x025a, 0x025d, 0x025d,
+ 0x025f, 0x025f, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260,
+ 0x0260, 0x0261, 0x0261, 0x0261, 0x0261, 0x0261, 0x0261, 0x0261,
+ // Entry 1C0 - 1FF
+ 0x0261, 0x0261, 0x0270, 0x0270, 0x0271, 0x0271, 0x0276, 0x0276,
+ 0x0277, 0x0277, 0x0278, 0x0278, 0x0279, 0x027a, 0x027a, 0x027a,
+ 0x027a, 0x027c, 0x027c, 0x027d, 0x027d, 0x027d, 0x0290, 0x0290,
+ 0x0291, 0x0291, 0x0292, 0x0292, 0x0293, 0x0293, 0x0298, 0x0298,
+ 0x0299, 0x0299, 0x029a, 0x029b, 0x029b, 0x029c, 0x029c, 0x029d,
+ 0x029d, 0x029e, 0x029e, 0x029e, 0x029e, 0x02aa, 0x02aa, 0x02ad,
+ 0x02ad, 0x02b0, 0x02b0, 0x02b0, 0x02b2, 0x02b2, 0x02b6, 0x02b7,
+ 0x02b7, 0x02b8, 0x02b8, 0x02b8, 0x02b8, 0x02b8, 0x02bf, 0x02bf,
+ // Entry 200 - 23F
+ 0x02c0, 0x02c0, 0x02c0, 0x02c1, 0x02c1, 0x02d3, 0x02d3, 0x02d3,
+ 0x02d3, 0x02d3, 0x02d3, 0x02d3, 0x02d3, 0x02d5, 0x02d5, 0x02d5,
+ 0x02db, 0x02dc, 0x02dc, 0x02dd, 0x02de, 0x02de, 0x02df, 0x02e0,
+ 0x02e0, 0x02e0, 0x02f3, 0x02f3, 0x02f3, 0x02f3, 0x02f3, 0x02f3,
+ 0x02f3, 0x02f3, 0x02f5, 0x02f5, 0x02f5, 0x02f6, 0x02f6, 0x02f7,
+ 0x02f7, 0x02f8, 0x02fa, 0x02fa, 0x02fc, 0x02fc, 0x02fe, 0x02ff,
+ 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x030f, 0x030f, 0x030f,
+ 0x030f, 0x0310, 0x0310, 0x0313, 0x0314, 0x0314, 0x0314, 0x0316,
+ // Entry 240 - 27F
+ 0x0316, 0x0316, 0x0317, 0x0318, 0x0319, 0x031a, 0x031b, 0x031b,
+ 0x031c, 0x031e, 0x0320, 0x0320, 0x0320, 0x0320, 0x0321, 0x0321,
+ 0x0332, 0x0333, 0x0333, 0x0334, 0x0334, 0x033c, 0x033e, 0x033f,
+ 0x0340, 0x0341, 0x0341, 0x0341, 0x0342, 0x0342, 0x0343, 0x0343,
+ 0x0344, 0x0344, 0x0345, 0x0345, 0x0346, 0x0346, 0x0347, 0x0347,
+ 0x0347, 0x034b, 0x034b, 0x034b, 0x034d, 0x034e, 0x034e, 0x034e,
+ 0x034e, 0x034e, 0x034e, 0x034e, 0x034e, 0x034e, 0x034e, 0x034e,
+ 0x034e, 0x0351, 0x0351, 0x035f, 0x035f, 0x0369, 0x0369, 0x0369,
+ // Entry 280 - 2BF
+ 0x0369, 0x0369, 0x0369, 0x0369, 0x0369, 0x0369, 0x0369, 0x036a,
+ 0x036b, 0x036c, 0x036d, 0x036d, 0x036f, 0x036f, 0x0370, 0x0370,
+ 0x0376, 0x0376, 0x0376, 0x0376, 0x0376, 0x0376, 0x037c, 0x037c,
+ 0x037c, 0x037c, 0x037c, 0x037c, 0x037c, 0x037c, 0x0394, 0x0394,
+ 0x0394, 0x0394, 0x0397, 0x0398, 0x0398, 0x0398, 0x0399, 0x0399,
+ 0x039c, 0x039c, 0x039d, 0x039f, 0x03a2, 0x03a4, 0x03a4, 0x03a5,
+ 0x03a6, 0x03a6, 0x03a8, 0x03a8, 0x03aa, 0x03aa, 0x03ab, 0x03ac,
+ 0x03ac, 0x03ac, 0x03ae, 0x03ae, 0x03ae, 0x03ae, 0x03b1, 0x03b1,
+ // Entry 2C0 - 2FF
+ 0x03b6, 0x03b6, 0x03b6, 0x03b6, 0x03b8, 0x03b8, 0x03b8, 0x03b8,
+ 0x03b8, 0x03b8, 0x03ba, 0x03ba, 0x03cd, 0x03cd, 0x03d0, 0x03d1,
+ 0x03d1, 0x03d2, 0x03d3, 0x03d3, 0x03d5, 0x03d5, 0x03d5, 0x03d5,
+ 0x03d6, 0x03d7, 0x03d7, 0x03d7, 0x03d7, 0x03d7, 0x03d9, 0x03d9,
+ 0x03d9, 0x03d9, 0x03da, 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03dd,
+ 0x03dd, 0x03dd, 0x03de, 0x03de, 0x03de, 0x03de, 0x03de, 0x03de,
+ 0x03df, 0x03df, 0x03df, 0x03e2, 0x03e5, 0x03e5, 0x03e5, 0x03e5,
+ 0x03e5, 0x03e5, 0x03e9, 0x03e9, 0x03e9, 0x03ea, 0x03ec, 0x03ee,
+ // Entry 300 - 33F
+ 0x03f2, 0x03f4, 0x03f5, 0x03f5, 0x03f7, 0x03f7, 0x03f7, 0x03f7,
+} // Size: 1576 bytes
+
+var normalSymIndex = []curToIndex{ // 1015 elements
+ 0: {cur: 0x13, idx: 0x6},
+ 1: {cur: 0x2e, idx: 0x13},
+ 2: {cur: 0x3a, idx: 0x1c},
+ 3: {cur: 0x44, idx: 0x20},
+ 4: {cur: 0x5e, idx: 0x3b},
+ 5: {cur: 0x63, idx: 0x3f},
+ 6: {cur: 0x72, idx: 0x4b},
+ 7: {cur: 0x7c, idx: 0x5a},
+ 8: {cur: 0x7d, idx: 0x5e},
+ 9: {cur: 0x85, idx: 0x62},
+ 10: {cur: 0x8d, idx: 0x6e},
+ 11: {cur: 0xb2, idx: 0x90},
+ 12: {cur: 0xc0, idx: 0x9e},
+ 13: {cur: 0xf6, idx: 0xc7},
+ 14: {cur: 0xfc, idx: 0xcf},
+ 15: {cur: 0x105, idx: 0xd3},
+ 16: {cur: 0x109, idx: 0xd7},
+ 17: {cur: 0x110, idx: 0xdc},
+ 18: {cur: 0x115, idx: 0xe0},
+ 19: {cur: 0x117, idx: 0xe4},
+ 20: {cur: 0xb2, idx: 0x0},
+ 21: {cur: 0xeb, idx: 0xbc},
+ 22: {cur: 0x125, idx: 0xe9},
+ 23: {cur: 0xb9, idx: 0x4},
+ 24: {cur: 0x67, idx: 0xf2},
+ 25: {cur: 0x13, idx: 0xf8},
+ 26: {cur: 0x42, idx: 0xfc},
+ 27: {cur: 0x5d, idx: 0x113},
+ 28: {cur: 0xeb, idx: 0xbc},
+ 29: {cur: 0x0, idx: 0x11a},
+ 30: {cur: 0x2, idx: 0x11e},
+ 31: {cur: 0x13, idx: 0xf8},
+ 32: {cur: 0x23, idx: 0x130},
+ 33: {cur: 0x54, idx: 0x15a},
+ 34: {cur: 0x58, idx: 0x164},
+ 35: {cur: 0x7e, idx: 0x17b},
+ 36: {cur: 0x7f, idx: 0x185},
+ 37: {cur: 0x84, idx: 0x190},
+ 38: {cur: 0x8e, idx: 0x19a},
+ 39: {cur: 0x92, idx: 0x1a8},
+ 40: {cur: 0x9d, idx: 0x1b2},
+ 41: {cur: 0x9e, idx: 0x1bc},
+ 42: {cur: 0xab, idx: 0x1c6},
+ 43: {cur: 0xc1, idx: 0x1d0},
+ 44: {cur: 0xcd, idx: 0x1da},
+ 45: {cur: 0xd5, idx: 0x1e4},
+ 46: {cur: 0xd8, idx: 0x1f2},
+ 47: {cur: 0xd9, idx: 0x1fc},
+ 48: {cur: 0xe9, idx: 0x207},
+ 49: {cur: 0xeb, idx: 0xbc},
+ 50: {cur: 0xf0, idx: 0x211},
+ 51: {cur: 0x11f, idx: 0x223},
+ 52: {cur: 0x51, idx: 0x22d},
+ 53: {cur: 0x59, idx: 0x231},
+ 54: {cur: 0x89, idx: 0x6b},
+ 55: {cur: 0xd9, idx: 0x0},
+ 56: {cur: 0xe1, idx: 0x235},
+ 57: {cur: 0x63, idx: 0x237},
+ 58: {cur: 0xe4, idx: 0x3f},
+ 59: {cur: 0xf7, idx: 0x23c},
+ 60: {cur: 0x85, idx: 0x25},
+ 61: {cur: 0xeb, idx: 0xbc},
+ 62: {cur: 0xfc, idx: 0x4},
+ 63: {cur: 0x16, idx: 0x240},
+ 64: {cur: 0xeb, idx: 0xbc},
+ 65: {cur: 0x16, idx: 0x240},
+ 66: {cur: 0x2e, idx: 0x0},
+ 67: {cur: 0x37, idx: 0x258},
+ 68: {cur: 0x3a, idx: 0x0},
+ 69: {cur: 0x85, idx: 0x25},
+ 70: {cur: 0xc0, idx: 0x0},
+ 71: {cur: 0xd2, idx: 0xb2},
+ 72: {cur: 0xfc, idx: 0x4},
+ 73: {cur: 0x127, idx: 0x8a},
+ 74: {cur: 0xf7, idx: 0x23c},
+ 75: {cur: 0x13, idx: 0x0},
+ 76: {cur: 0x21, idx: 0x294},
+ 77: {cur: 0x2e, idx: 0x0},
+ 78: {cur: 0x3a, idx: 0x0},
+ 79: {cur: 0x44, idx: 0x0},
+ 80: {cur: 0x63, idx: 0x0},
+ 81: {cur: 0x72, idx: 0x0},
+ 82: {cur: 0x7c, idx: 0x0},
+ 83: {cur: 0x7d, idx: 0x0},
+ 84: {cur: 0x85, idx: 0x0},
+ 85: {cur: 0x8d, idx: 0x0},
+ 86: {cur: 0xb2, idx: 0x0},
+ 87: {cur: 0xc0, idx: 0x0},
+ 88: {cur: 0xf6, idx: 0x0},
+ 89: {cur: 0xfc, idx: 0x29a},
+ 90: {cur: 0x105, idx: 0x0},
+ 91: {cur: 0x110, idx: 0x0},
+ 92: {cur: 0x1b, idx: 0xc},
+ 93: {cur: 0xeb, idx: 0xbc},
+ 94: {cur: 0x44, idx: 0x25},
+ 95: {cur: 0x44, idx: 0x20},
+ 96: {cur: 0x13, idx: 0x2a1},
+ 97: {cur: 0x2e, idx: 0x0},
+ 98: {cur: 0x3a, idx: 0x2a4},
+ 99: {cur: 0x44, idx: 0x0},
+ 100: {cur: 0x63, idx: 0x2ad},
+ 101: {cur: 0x72, idx: 0x2b3},
+ 102: {cur: 0x7c, idx: 0x0},
+ 103: {cur: 0x85, idx: 0x0},
+ 104: {cur: 0x8d, idx: 0x0},
+ 105: {cur: 0xc0, idx: 0x2bc},
+ 106: {cur: 0xf6, idx: 0x0},
+ 107: {cur: 0xfc, idx: 0x2c5},
+ 108: {cur: 0x105, idx: 0x0},
+ 109: {cur: 0x110, idx: 0x0},
+ 110: {cur: 0x13, idx: 0x0},
+ 111: {cur: 0x18, idx: 0x9},
+ 112: {cur: 0x2e, idx: 0x0},
+ 113: {cur: 0x3a, idx: 0x0},
+ 114: {cur: 0x44, idx: 0x0},
+ 115: {cur: 0x63, idx: 0x0},
+ 116: {cur: 0x72, idx: 0x0},
+ 117: {cur: 0x75, idx: 0x51},
+ 118: {cur: 0x7c, idx: 0x0},
+ 119: {cur: 0x85, idx: 0x25},
+ 120: {cur: 0xb2, idx: 0x0},
+ 121: {cur: 0xc0, idx: 0x0},
+ 122: {cur: 0xd1, idx: 0x2ca},
+ 123: {cur: 0xeb, idx: 0xbc},
+ 124: {cur: 0xfc, idx: 0x0},
+ 125: {cur: 0x110, idx: 0x0},
+ 126: {cur: 0x117, idx: 0x0},
+ 127: {cur: 0x18, idx: 0x2cf},
+ 128: {cur: 0x4e, idx: 0x2d4},
+ 129: {cur: 0x85, idx: 0x25},
+ 130: {cur: 0xc9, idx: 0x2d9},
+ 131: {cur: 0xd1, idx: 0x2de},
+ 132: {cur: 0xf4, idx: 0x2e6},
+ 133: {cur: 0x13, idx: 0xf8},
+ 134: {cur: 0x2e, idx: 0x0},
+ 135: {cur: 0x3a, idx: 0x0},
+ 136: {cur: 0x44, idx: 0x25},
+ 137: {cur: 0x5c, idx: 0x37},
+ 138: {cur: 0xb2, idx: 0x0},
+ 139: {cur: 0xeb, idx: 0xbc},
+ 140: {cur: 0xfc, idx: 0x0},
+ 141: {cur: 0x110, idx: 0x0},
+ 142: {cur: 0x62, idx: 0x2eb},
+ 143: {cur: 0x1b, idx: 0xc},
+ 144: {cur: 0xeb, idx: 0xbc},
+ 145: {cur: 0xd2, idx: 0xb2},
+ 146: {cur: 0xfb, idx: 0x2f4},
+ 147: {cur: 0xfc, idx: 0x4},
+ 148: {cur: 0x7e, idx: 0x17b},
+ 149: {cur: 0x13, idx: 0xf8},
+ 150: {cur: 0x49, idx: 0x2f8},
+ 151: {cur: 0x4e, idx: 0x2c},
+ 152: {cur: 0x7c, idx: 0x0},
+ 153: {cur: 0x7d, idx: 0x0},
+ 154: {cur: 0x105, idx: 0x0},
+ 155: {cur: 0x112, idx: 0x2fd},
+ 156: {cur: 0xd2, idx: 0xb2},
+ 157: {cur: 0x8d, idx: 0x0},
+ 158: {cur: 0xeb, idx: 0xbc},
+ 159: {cur: 0x13, idx: 0xf8},
+ 160: {cur: 0x52, idx: 0x304},
+ 161: {cur: 0xeb, idx: 0xbc},
+ 162: {cur: 0xfc, idx: 0x4},
+ 163: {cur: 0x86, idx: 0x308},
+ 164: {cur: 0x12, idx: 0x30c},
+ 165: {cur: 0x13, idx: 0xf8},
+ 166: {cur: 0x20, idx: 0x310},
+ 167: {cur: 0x22, idx: 0x314},
+ 168: {cur: 0x50, idx: 0x31d},
+ 169: {cur: 0x85, idx: 0x25},
+ 170: {cur: 0xeb, idx: 0xbc},
+ 171: {cur: 0xfc, idx: 0x4},
+ 172: {cur: 0x5e, idx: 0x0},
+ 173: {cur: 0x5e, idx: 0x0},
+ 174: {cur: 0x99, idx: 0x2eb},
+ 175: {cur: 0x13, idx: 0x0},
+ 176: {cur: 0x85, idx: 0x25},
+ 177: {cur: 0xc9, idx: 0xa6},
+ 178: {cur: 0xeb, idx: 0xbc},
+ 179: {cur: 0xfc, idx: 0x4},
+ 180: {cur: 0x13, idx: 0xf8},
+ 181: {cur: 0x33, idx: 0x332},
+ 182: {cur: 0x7c, idx: 0x0},
+ 183: {cur: 0x8d, idx: 0x336},
+ 184: {cur: 0xeb, idx: 0x33c},
+ 185: {cur: 0x109, idx: 0x0},
+ 186: {cur: 0x86, idx: 0x308},
+ 187: {cur: 0x13, idx: 0xf8},
+ 188: {cur: 0x67, idx: 0xf2},
+ 189: {cur: 0xeb, idx: 0xbc},
+ 190: {cur: 0x6d, idx: 0x342},
+ 191: {cur: 0xeb, idx: 0xbc},
+ 192: {cur: 0xfc, idx: 0x4},
+ 193: {cur: 0x85, idx: 0x25},
+ 194: {cur: 0xfc, idx: 0x4},
+ 195: {cur: 0x85, idx: 0x62},
+ 196: {cur: 0xfc, idx: 0xcf},
+ 197: {cur: 0x110, idx: 0x4},
+ 198: {cur: 0x110, idx: 0x4},
+ 199: {cur: 0x13, idx: 0x4},
+ 200: {cur: 0x2e, idx: 0x0},
+ 201: {cur: 0x3a, idx: 0x0},
+ 202: {cur: 0x44, idx: 0x0},
+ 203: {cur: 0x5e, idx: 0x0},
+ 204: {cur: 0x63, idx: 0x0},
+ 205: {cur: 0x72, idx: 0x0},
+ 206: {cur: 0x7c, idx: 0x0},
+ 207: {cur: 0x7d, idx: 0x0},
+ 208: {cur: 0x85, idx: 0x0},
+ 209: {cur: 0x8d, idx: 0x0},
+ 210: {cur: 0xb2, idx: 0x0},
+ 211: {cur: 0xc0, idx: 0x0},
+ 212: {cur: 0xd7, idx: 0x7e},
+ 213: {cur: 0xf6, idx: 0x0},
+ 214: {cur: 0xfc, idx: 0x0},
+ 215: {cur: 0x105, idx: 0x0},
+ 216: {cur: 0x109, idx: 0x0},
+ 217: {cur: 0x110, idx: 0x0},
+ 218: {cur: 0x115, idx: 0x0},
+ 219: {cur: 0x117, idx: 0x355},
+ 220: {cur: 0x1a, idx: 0x4},
+ 221: {cur: 0x24, idx: 0x359},
+ 222: {cur: 0x25, idx: 0x4},
+ 223: {cur: 0x32, idx: 0x4},
+ 224: {cur: 0x35, idx: 0x16},
+ 225: {cur: 0x39, idx: 0x4},
+ 226: {cur: 0x3a, idx: 0x4},
+ 227: {cur: 0x13, idx: 0x4},
+ 228: {cur: 0xc0, idx: 0x4},
+ 229: {cur: 0x13, idx: 0x4},
+ 230: {cur: 0x52, idx: 0x304},
+ 231: {cur: 0x110, idx: 0x4},
+ 232: {cur: 0x59, idx: 0x231},
+ 233: {cur: 0x60, idx: 0x4},
+ 234: {cur: 0x61, idx: 0x3f},
+ 235: {cur: 0x63, idx: 0x237},
+ 236: {cur: 0x110, idx: 0x4},
+ 237: {cur: 0x67, idx: 0xf2},
+ 238: {cur: 0x63, idx: 0x237},
+ 239: {cur: 0x68, idx: 0x3f},
+ 240: {cur: 0x69, idx: 0x35d},
+ 241: {cur: 0x71, idx: 0x4},
+ 242: {cur: 0x83, idx: 0x4},
+ 243: {cur: 0x86, idx: 0x308},
+ 244: {cur: 0x13, idx: 0x4},
+ 245: {cur: 0x110, idx: 0x4},
+ 246: {cur: 0x8f, idx: 0x4},
+ 247: {cur: 0x110, idx: 0x4},
+ 248: {cur: 0x94, idx: 0x4},
+ 249: {cur: 0x125, idx: 0xe9},
+ 250: {cur: 0xa3, idx: 0x87},
+ 251: {cur: 0xaa, idx: 0x35f},
+ 252: {cur: 0x110, idx: 0x4},
+ 253: {cur: 0x63, idx: 0x237},
+ 254: {cur: 0xae, idx: 0x7e},
+ 255: {cur: 0xb1, idx: 0x364},
+ 256: {cur: 0xb5, idx: 0x94},
+ 257: {cur: 0xb9, idx: 0x4},
+ 258: {cur: 0x13, idx: 0x4},
+ 259: {cur: 0xba, idx: 0x97},
+ 260: {cur: 0x13, idx: 0x4},
+ 261: {cur: 0xc0, idx: 0x4},
+ 262: {cur: 0xc0, idx: 0x4},
+ 263: {cur: 0xc6, idx: 0x8a},
+ 264: {cur: 0xc7, idx: 0xa2},
+ 265: {cur: 0xc8, idx: 0x7e},
+ 266: {cur: 0xc0, idx: 0x4},
+ 267: {cur: 0xd4, idx: 0xb6},
+ 268: {cur: 0xd6, idx: 0x4},
+ 269: {cur: 0xd7, idx: 0x367},
+ 270: {cur: 0xdb, idx: 0x30},
+ 271: {cur: 0xdc, idx: 0x4},
+ 272: {cur: 0x63, idx: 0x237},
+ 273: {cur: 0xdd, idx: 0x3f},
+ 274: {cur: 0xe0, idx: 0x36a},
+ 275: {cur: 0x63, idx: 0x237},
+ 276: {cur: 0xe4, idx: 0x3f},
+ 277: {cur: 0x8, idx: 0x36d},
+ 278: {cur: 0xea, idx: 0x372},
+ 279: {cur: 0xc0, idx: 0x4},
+ 280: {cur: 0xf1, idx: 0xc0},
+ 281: {cur: 0xf5, idx: 0x4},
+ 282: {cur: 0x13, idx: 0x4},
+ 283: {cur: 0xf7, idx: 0x23c},
+ 284: {cur: 0xfb, idx: 0x2f4},
+ 285: {cur: 0x110, idx: 0x4},
+ 286: {cur: 0x107, idx: 0x374},
+ 287: {cur: 0x108, idx: 0x377},
+ 288: {cur: 0x125, idx: 0xe9},
+ 289: {cur: 0x127, idx: 0x8a},
+ 290: {cur: 0x13, idx: 0x0},
+ 291: {cur: 0x2e, idx: 0x0},
+ 292: {cur: 0x44, idx: 0x0},
+ 293: {cur: 0x5c, idx: 0x37},
+ 294: {cur: 0x63, idx: 0x0},
+ 295: {cur: 0x72, idx: 0x0},
+ 296: {cur: 0x7c, idx: 0x0},
+ 297: {cur: 0x7d, idx: 0x0},
+ 298: {cur: 0x85, idx: 0x0},
+ 299: {cur: 0x8d, idx: 0x0},
+ 300: {cur: 0xb2, idx: 0x0},
+ 301: {cur: 0xc0, idx: 0x0},
+ 302: {cur: 0xeb, idx: 0xbc},
+ 303: {cur: 0xf6, idx: 0x0},
+ 304: {cur: 0x109, idx: 0x0},
+ 305: {cur: 0x110, idx: 0x0},
+ 306: {cur: 0x115, idx: 0x0},
+ 307: {cur: 0x3a, idx: 0x0},
+ 308: {cur: 0x5e, idx: 0x0},
+ 309: {cur: 0xeb, idx: 0x0},
+ 310: {cur: 0xfc, idx: 0x0},
+ 311: {cur: 0x105, idx: 0x0},
+ 312: {cur: 0x11, idx: 0x4},
+ 313: {cur: 0xfc, idx: 0xcf},
+ 314: {cur: 0x27, idx: 0x10},
+ 315: {cur: 0x2e, idx: 0x13},
+ 316: {cur: 0x39, idx: 0x4},
+ 317: {cur: 0x41, idx: 0x4},
+ 318: {cur: 0xfc, idx: 0xcf},
+ 319: {cur: 0x45, idx: 0x4},
+ 320: {cur: 0xfc, idx: 0xcf},
+ 321: {cur: 0x47, idx: 0x28},
+ 322: {cur: 0x4b, idx: 0x4},
+ 323: {cur: 0xfc, idx: 0xcf},
+ 324: {cur: 0x53, idx: 0x264},
+ 325: {cur: 0xfc, idx: 0xcf},
+ 326: {cur: 0xfc, idx: 0x4},
+ 327: {cur: 0x109, idx: 0xd7},
+ 328: {cur: 0x6e, idx: 0x49},
+ 329: {cur: 0x73, idx: 0x4f},
+ 330: {cur: 0xb2, idx: 0x4},
+ 331: {cur: 0xbc, idx: 0x9b},
+ 332: {cur: 0xc2, idx: 0x387},
+ 333: {cur: 0xc4, idx: 0x38b},
+ 334: {cur: 0xc7, idx: 0xa2},
+ 335: {cur: 0xfc, idx: 0x4},
+ 336: {cur: 0xcc, idx: 0x38e},
+ 337: {cur: 0xfc, idx: 0x4},
+ 338: {cur: 0x85, idx: 0x25},
+ 339: {cur: 0xfc, idx: 0x4},
+ 340: {cur: 0xfc, idx: 0xcf},
+ 341: {cur: 0x101, idx: 0x4},
+ 342: {cur: 0x104, idx: 0x392},
+ 343: {cur: 0x13, idx: 0xf8},
+ 344: {cur: 0x57, idx: 0x30},
+ 345: {cur: 0x85, idx: 0x25},
+ 346: {cur: 0xeb, idx: 0xbc},
+ 347: {cur: 0xfc, idx: 0x4},
+ 348: {cur: 0x5c, idx: 0x37},
+ 349: {cur: 0xeb, idx: 0xbc},
+ 350: {cur: 0x4, idx: 0x396},
+ 351: {cur: 0x3a, idx: 0x2a4},
+ 352: {cur: 0x44, idx: 0x399},
+ 353: {cur: 0x72, idx: 0x39e},
+ 354: {cur: 0x7f, idx: 0x3a2},
+ 355: {cur: 0x85, idx: 0x25},
+ 356: {cur: 0xb2, idx: 0x3ab},
+ 357: {cur: 0xc0, idx: 0x3af},
+ 358: {cur: 0xeb, idx: 0xbc},
+ 359: {cur: 0xfc, idx: 0x4},
+ 360: {cur: 0x110, idx: 0x3b3},
+ 361: {cur: 0x6a, idx: 0x46},
+ 362: {cur: 0xab, idx: 0x3b7},
+ 363: {cur: 0x13, idx: 0x0},
+ 364: {cur: 0x2e, idx: 0x0},
+ 365: {cur: 0x3a, idx: 0x0},
+ 366: {cur: 0x44, idx: 0x0},
+ 367: {cur: 0x5f, idx: 0x3ba},
+ 368: {cur: 0x72, idx: 0x0},
+ 369: {cur: 0x7c, idx: 0x0},
+ 370: {cur: 0x7d, idx: 0x0},
+ 371: {cur: 0x85, idx: 0x25},
+ 372: {cur: 0x8d, idx: 0x0},
+ 373: {cur: 0xb2, idx: 0x0},
+ 374: {cur: 0xc0, idx: 0x0},
+ 375: {cur: 0xf6, idx: 0x0},
+ 376: {cur: 0xfc, idx: 0x4},
+ 377: {cur: 0x105, idx: 0x0},
+ 378: {cur: 0x110, idx: 0x0},
+ 379: {cur: 0x117, idx: 0x0},
+ 380: {cur: 0x85, idx: 0x25},
+ 381: {cur: 0xc7, idx: 0xa2},
+ 382: {cur: 0xeb, idx: 0xbc},
+ 383: {cur: 0xfc, idx: 0x4},
+ 384: {cur: 0x52, idx: 0x30},
+ 385: {cur: 0x52, idx: 0x304},
+ 386: {cur: 0x11, idx: 0x3bd},
+ 387: {cur: 0x13, idx: 0x3c1},
+ 388: {cur: 0x1d, idx: 0x3c5},
+ 389: {cur: 0x25, idx: 0x3c8},
+ 390: {cur: 0x26, idx: 0x3cc},
+ 391: {cur: 0x32, idx: 0x3d0},
+ 392: {cur: 0x39, idx: 0x3d4},
+ 393: {cur: 0x3a, idx: 0x2a4},
+ 394: {cur: 0x41, idx: 0x3d8},
+ 395: {cur: 0x44, idx: 0x0},
+ 396: {cur: 0x45, idx: 0x3dc},
+ 397: {cur: 0x4d, idx: 0x3e0},
+ 398: {cur: 0x60, idx: 0x3e9},
+ 399: {cur: 0x61, idx: 0x3ed},
+ 400: {cur: 0x62, idx: 0x2eb},
+ 401: {cur: 0x63, idx: 0x3f2},
+ 402: {cur: 0x68, idx: 0x3f7},
+ 403: {cur: 0x72, idx: 0x0},
+ 404: {cur: 0x79, idx: 0x3fc},
+ 405: {cur: 0x7a, idx: 0x401},
+ 406: {cur: 0x82, idx: 0x406},
+ 407: {cur: 0x85, idx: 0x0},
+ 408: {cur: 0x92, idx: 0x40c},
+ 409: {cur: 0xad, idx: 0x411},
+ 410: {cur: 0xb2, idx: 0x3ab},
+ 411: {cur: 0xb9, idx: 0x416},
+ 412: {cur: 0xc0, idx: 0x3af},
+ 413: {cur: 0xce, idx: 0x41d},
+ 414: {cur: 0xd6, idx: 0x424},
+ 415: {cur: 0xdc, idx: 0x428},
+ 416: {cur: 0xe2, idx: 0x42c},
+ 417: {cur: 0xf5, idx: 0x430},
+ 418: {cur: 0xf6, idx: 0x0},
+ 419: {cur: 0xfc, idx: 0x434},
+ 420: {cur: 0x101, idx: 0x438},
+ 421: {cur: 0x108, idx: 0x377},
+ 422: {cur: 0x110, idx: 0x0},
+ 423: {cur: 0x117, idx: 0x43c},
+ 424: {cur: 0x24, idx: 0x359},
+ 425: {cur: 0x11, idx: 0x0},
+ 426: {cur: 0x13, idx: 0x444},
+ 427: {cur: 0x25, idx: 0x0},
+ 428: {cur: 0x26, idx: 0x0},
+ 429: {cur: 0x32, idx: 0x0},
+ 430: {cur: 0x39, idx: 0x0},
+ 431: {cur: 0x3a, idx: 0x4},
+ 432: {cur: 0x41, idx: 0x0},
+ 433: {cur: 0x44, idx: 0x20},
+ 434: {cur: 0x45, idx: 0x0},
+ 435: {cur: 0x60, idx: 0x0},
+ 436: {cur: 0x61, idx: 0x0},
+ 437: {cur: 0x63, idx: 0x3f},
+ 438: {cur: 0x68, idx: 0x0},
+ 439: {cur: 0x72, idx: 0x44a},
+ 440: {cur: 0x7c, idx: 0x0},
+ 441: {cur: 0x7d, idx: 0x0},
+ 442: {cur: 0x85, idx: 0x25},
+ 443: {cur: 0x8d, idx: 0x0},
+ 444: {cur: 0x92, idx: 0x0},
+ 445: {cur: 0xb2, idx: 0x0},
+ 446: {cur: 0xb9, idx: 0x0},
+ 447: {cur: 0xc0, idx: 0x450},
+ 448: {cur: 0xd6, idx: 0x0},
+ 449: {cur: 0xdc, idx: 0x456},
+ 450: {cur: 0xe2, idx: 0x0},
+ 451: {cur: 0xf5, idx: 0x0},
+ 452: {cur: 0xfc, idx: 0x45c},
+ 453: {cur: 0x101, idx: 0x0},
+ 454: {cur: 0x105, idx: 0x0},
+ 455: {cur: 0x109, idx: 0x0},
+ 456: {cur: 0x115, idx: 0x0},
+ 457: {cur: 0x117, idx: 0x0},
+ 458: {cur: 0x3b, idx: 0x32a},
+ 459: {cur: 0x51, idx: 0x22d},
+ 460: {cur: 0x54, idx: 0x462},
+ 461: {cur: 0x6a, idx: 0x46},
+ 462: {cur: 0x76, idx: 0x465},
+ 463: {cur: 0x89, idx: 0x6b},
+ 464: {cur: 0x62, idx: 0x0},
+ 465: {cur: 0x99, idx: 0x2eb},
+ 466: {cur: 0xa3, idx: 0x87},
+ 467: {cur: 0xab, idx: 0x3b7},
+ 468: {cur: 0xae, idx: 0x7e},
+ 469: {cur: 0xd4, idx: 0xb6},
+ 470: {cur: 0xd7, idx: 0x367},
+ 471: {cur: 0xe9, idx: 0x467},
+ 472: {cur: 0xf0, idx: 0x46a},
+ 473: {cur: 0x107, idx: 0x374},
+ 474: {cur: 0x13, idx: 0xf8},
+ 475: {cur: 0x3a, idx: 0x9b},
+ 476: {cur: 0x60, idx: 0x16e},
+ 477: {cur: 0xd6, idx: 0x28a},
+ 478: {cur: 0xeb, idx: 0xbc},
+ 479: {cur: 0x117, idx: 0x0},
+ 480: {cur: 0x85, idx: 0x25},
+ 481: {cur: 0xeb, idx: 0xbc},
+ 482: {cur: 0xfc, idx: 0x4},
+ 483: {cur: 0xeb, idx: 0xbc},
+ 484: {cur: 0xfc, idx: 0x4},
+ 485: {cur: 0x5c, idx: 0x37},
+ 486: {cur: 0xb2, idx: 0x3ab},
+ 487: {cur: 0xeb, idx: 0xbc},
+ 488: {cur: 0xfc, idx: 0x4},
+ 489: {cur: 0x12, idx: 0x30c},
+ 490: {cur: 0x85, idx: 0x25},
+ 491: {cur: 0xfc, idx: 0x4},
+ 492: {cur: 0xeb, idx: 0xbc},
+ 493: {cur: 0x86, idx: 0x308},
+ 494: {cur: 0xba, idx: 0x97},
+ 495: {cur: 0x67, idx: 0xf2},
+ 496: {cur: 0xfc, idx: 0x4},
+ 497: {cur: 0x44, idx: 0x47c},
+ 498: {cur: 0x7a, idx: 0x487},
+ 499: {cur: 0x85, idx: 0x25},
+ 500: {cur: 0xeb, idx: 0xbc},
+ 501: {cur: 0xfc, idx: 0x4},
+ 502: {cur: 0xeb, idx: 0xbc},
+ 503: {cur: 0xfc, idx: 0x4},
+ 504: {cur: 0x13, idx: 0x0},
+ 505: {cur: 0x2e, idx: 0x0},
+ 506: {cur: 0x3a, idx: 0x0},
+ 507: {cur: 0x44, idx: 0x0},
+ 508: {cur: 0x5e, idx: 0x0},
+ 509: {cur: 0x63, idx: 0x0},
+ 510: {cur: 0x72, idx: 0x0},
+ 511: {cur: 0x7c, idx: 0x0},
+ 512: {cur: 0x7d, idx: 0x0},
+ 513: {cur: 0x85, idx: 0x0},
+ 514: {cur: 0x8d, idx: 0x0},
+ 515: {cur: 0xb2, idx: 0x0},
+ 516: {cur: 0xc0, idx: 0x0},
+ 517: {cur: 0xf6, idx: 0x0},
+ 518: {cur: 0xfc, idx: 0x0},
+ 519: {cur: 0x105, idx: 0x0},
+ 520: {cur: 0x110, idx: 0x0},
+ 521: {cur: 0x117, idx: 0x0},
+ 522: {cur: 0x18, idx: 0x9},
+ 523: {cur: 0x13, idx: 0x0},
+ 524: {cur: 0x85, idx: 0x25},
+ 525: {cur: 0xc9, idx: 0xa6},
+ 526: {cur: 0xeb, idx: 0xbc},
+ 527: {cur: 0xfc, idx: 0x4},
+ 528: {cur: 0x13, idx: 0x0},
+ 529: {cur: 0x2e, idx: 0x0},
+ 530: {cur: 0x3a, idx: 0x0},
+ 531: {cur: 0x44, idx: 0x0},
+ 532: {cur: 0x5e, idx: 0x0},
+ 533: {cur: 0x63, idx: 0x0},
+ 534: {cur: 0x72, idx: 0x0},
+ 535: {cur: 0x77, idx: 0x54},
+ 536: {cur: 0x7c, idx: 0x0},
+ 537: {cur: 0x7d, idx: 0x0},
+ 538: {cur: 0x85, idx: 0x25},
+ 539: {cur: 0x8d, idx: 0x0},
+ 540: {cur: 0xb2, idx: 0x0},
+ 541: {cur: 0xc0, idx: 0x0},
+ 542: {cur: 0xf6, idx: 0x0},
+ 543: {cur: 0xfc, idx: 0x0},
+ 544: {cur: 0x105, idx: 0x0},
+ 545: {cur: 0x110, idx: 0x0},
+ 546: {cur: 0x7, idx: 0x498},
+ 547: {cur: 0xeb, idx: 0xbc},
+ 548: {cur: 0xfc, idx: 0x4},
+ 549: {cur: 0x13, idx: 0xf8},
+ 550: {cur: 0x78, idx: 0x57},
+ 551: {cur: 0x7d, idx: 0x7e},
+ 552: {cur: 0xeb, idx: 0xbc},
+ 553: {cur: 0xba, idx: 0x97},
+ 554: {cur: 0x44, idx: 0x25},
+ 555: {cur: 0x13, idx: 0x0},
+ 556: {cur: 0x2e, idx: 0x0},
+ 557: {cur: 0x3a, idx: 0x0},
+ 558: {cur: 0x5e, idx: 0x0},
+ 559: {cur: 0x63, idx: 0x0},
+ 560: {cur: 0x7d, idx: 0x0},
+ 561: {cur: 0x8d, idx: 0x0},
+ 562: {cur: 0xb2, idx: 0x0},
+ 563: {cur: 0xc0, idx: 0x0},
+ 564: {cur: 0xf6, idx: 0x0},
+ 565: {cur: 0xfc, idx: 0x0},
+ 566: {cur: 0x105, idx: 0x0},
+ 567: {cur: 0x2e, idx: 0x0},
+ 568: {cur: 0x72, idx: 0x0},
+ 569: {cur: 0x85, idx: 0x0},
+ 570: {cur: 0x8d, idx: 0x0},
+ 571: {cur: 0xb2, idx: 0x0},
+ 572: {cur: 0xeb, idx: 0xbc},
+ 573: {cur: 0xf6, idx: 0x0},
+ 574: {cur: 0xfc, idx: 0x0},
+ 575: {cur: 0x44, idx: 0x49f},
+ 576: {cur: 0x85, idx: 0x4a3},
+ 577: {cur: 0xfc, idx: 0x4},
+ 578: {cur: 0xf7, idx: 0x23c},
+ 579: {cur: 0x13, idx: 0x0},
+ 580: {cur: 0x44, idx: 0x0},
+ 581: {cur: 0x65, idx: 0x42},
+ 582: {cur: 0x72, idx: 0x0},
+ 583: {cur: 0x7c, idx: 0x0},
+ 584: {cur: 0x7d, idx: 0x0},
+ 585: {cur: 0x85, idx: 0x0},
+ 586: {cur: 0x8d, idx: 0x0},
+ 587: {cur: 0xc0, idx: 0x0},
+ 588: {cur: 0x105, idx: 0x0},
+ 589: {cur: 0x54, idx: 0x462},
+ 590: {cur: 0x86, idx: 0x308},
+ 591: {cur: 0xf7, idx: 0x23c},
+ 592: {cur: 0x13, idx: 0xf8},
+ 593: {cur: 0x4c, idx: 0x4ae},
+ 594: {cur: 0xeb, idx: 0xbc},
+ 595: {cur: 0x86, idx: 0x308},
+ 596: {cur: 0x90, idx: 0x72},
+ 597: {cur: 0xd2, idx: 0xb2},
+ 598: {cur: 0xeb, idx: 0xbc},
+ 599: {cur: 0xfc, idx: 0x4},
+ 600: {cur: 0x52, idx: 0x304},
+ 601: {cur: 0x86, idx: 0x308},
+ 602: {cur: 0x88, idx: 0x67},
+ 603: {cur: 0xeb, idx: 0xbc},
+ 604: {cur: 0xfc, idx: 0x4},
+ 605: {cur: 0xeb, idx: 0xbc},
+ 606: {cur: 0xfc, idx: 0x4},
+ 607: {cur: 0x13, idx: 0xf8},
+ 608: {cur: 0xf7, idx: 0x23c},
+ 609: {cur: 0x13, idx: 0x0},
+ 610: {cur: 0x2e, idx: 0x0},
+ 611: {cur: 0x3a, idx: 0x0},
+ 612: {cur: 0x63, idx: 0x0},
+ 613: {cur: 0x72, idx: 0x0},
+ 614: {cur: 0x7c, idx: 0x0},
+ 615: {cur: 0x7d, idx: 0x0},
+ 616: {cur: 0x87, idx: 0x4bf},
+ 617: {cur: 0x8d, idx: 0x0},
+ 618: {cur: 0xb2, idx: 0x0},
+ 619: {cur: 0xc0, idx: 0x0},
+ 620: {cur: 0xeb, idx: 0xbc},
+ 621: {cur: 0xf6, idx: 0x0},
+ 622: {cur: 0xfc, idx: 0x0},
+ 623: {cur: 0x110, idx: 0x0},
+ 624: {cur: 0xf7, idx: 0x23c},
+ 625: {cur: 0x12, idx: 0x30c},
+ 626: {cur: 0x13, idx: 0xf8},
+ 627: {cur: 0x85, idx: 0x25},
+ 628: {cur: 0xeb, idx: 0xbc},
+ 629: {cur: 0xfc, idx: 0x4},
+ 630: {cur: 0xfb, idx: 0x2f4},
+ 631: {cur: 0xfc, idx: 0x4},
+ 632: {cur: 0x3b, idx: 0x32a},
+ 633: {cur: 0x9, idx: 0x1},
+ 634: {cur: 0x91, idx: 0x76},
+ 635: {cur: 0xeb, idx: 0xbc},
+ 636: {cur: 0x7e, idx: 0x17b},
+ 637: {cur: 0x13, idx: 0x0},
+ 638: {cur: 0x2e, idx: 0x0},
+ 639: {cur: 0x3a, idx: 0x0},
+ 640: {cur: 0x44, idx: 0x0},
+ 641: {cur: 0x63, idx: 0x0},
+ 642: {cur: 0x72, idx: 0x0},
+ 643: {cur: 0x7c, idx: 0x0},
+ 644: {cur: 0x7d, idx: 0x0},
+ 645: {cur: 0x85, idx: 0x0},
+ 646: {cur: 0x8d, idx: 0x0},
+ 647: {cur: 0xb2, idx: 0x0},
+ 648: {cur: 0xc0, idx: 0x0},
+ 649: {cur: 0xf6, idx: 0x0},
+ 650: {cur: 0xfc, idx: 0x0},
+ 651: {cur: 0x105, idx: 0x0},
+ 652: {cur: 0x109, idx: 0x0},
+ 653: {cur: 0x110, idx: 0x0},
+ 654: {cur: 0x115, idx: 0x0},
+ 655: {cur: 0x117, idx: 0x0},
+ 656: {cur: 0x3b, idx: 0x32a},
+ 657: {cur: 0x86, idx: 0x308},
+ 658: {cur: 0x86, idx: 0x308},
+ 659: {cur: 0x13, idx: 0xf8},
+ 660: {cur: 0x85, idx: 0x25},
+ 661: {cur: 0x9b, idx: 0x84},
+ 662: {cur: 0xeb, idx: 0xbc},
+ 663: {cur: 0xfc, idx: 0x4},
+ 664: {cur: 0x86, idx: 0x308},
+ 665: {cur: 0xf7, idx: 0x23c},
+ 666: {cur: 0x86, idx: 0x308},
+ 667: {cur: 0xae, idx: 0x7e},
+ 668: {cur: 0xa3, idx: 0x87},
+ 669: {cur: 0xb8, idx: 0x4cc},
+ 670: {cur: 0x13, idx: 0x0},
+ 671: {cur: 0x44, idx: 0x0},
+ 672: {cur: 0x63, idx: 0x0},
+ 673: {cur: 0x72, idx: 0x0},
+ 674: {cur: 0x7c, idx: 0x0},
+ 675: {cur: 0x7d, idx: 0x0},
+ 676: {cur: 0x85, idx: 0x0},
+ 677: {cur: 0x8d, idx: 0x0},
+ 678: {cur: 0xa5, idx: 0x4d0},
+ 679: {cur: 0xc0, idx: 0x0},
+ 680: {cur: 0xf6, idx: 0x0},
+ 681: {cur: 0x105, idx: 0x0},
+ 682: {cur: 0x85, idx: 0x25},
+ 683: {cur: 0xeb, idx: 0xbc},
+ 684: {cur: 0xfc, idx: 0x4},
+ 685: {cur: 0xa9, idx: 0x8c},
+ 686: {cur: 0xeb, idx: 0xbc},
+ 687: {cur: 0xfc, idx: 0x4},
+ 688: {cur: 0xeb, idx: 0xbc},
+ 689: {cur: 0xfc, idx: 0x4},
+ 690: {cur: 0x3a, idx: 0x0},
+ 691: {cur: 0xb2, idx: 0x0},
+ 692: {cur: 0xb5, idx: 0x94},
+ 693: {cur: 0xfc, idx: 0x0},
+ 694: {cur: 0x26, idx: 0x4},
+ 695: {cur: 0xdc, idx: 0x4},
+ 696: {cur: 0x8, idx: 0x4dc},
+ 697: {cur: 0x14, idx: 0x4e0},
+ 698: {cur: 0x76, idx: 0x465},
+ 699: {cur: 0xa8, idx: 0x8a},
+ 700: {cur: 0xc2, idx: 0x387},
+ 701: {cur: 0xeb, idx: 0xbc},
+ 702: {cur: 0xf5, idx: 0x21b},
+ 703: {cur: 0xfc, idx: 0x4},
+ 704: {cur: 0xb9, idx: 0x4},
+ 705: {cur: 0x13, idx: 0x0},
+ 706: {cur: 0x2e, idx: 0x0},
+ 707: {cur: 0x3a, idx: 0x0},
+ 708: {cur: 0x44, idx: 0x0},
+ 709: {cur: 0x72, idx: 0x0},
+ 710: {cur: 0x7c, idx: 0x0},
+ 711: {cur: 0x7d, idx: 0x0},
+ 712: {cur: 0x85, idx: 0x0},
+ 713: {cur: 0x8d, idx: 0x0},
+ 714: {cur: 0xb2, idx: 0x0},
+ 715: {cur: 0xbe, idx: 0x30},
+ 716: {cur: 0xc0, idx: 0x0},
+ 717: {cur: 0xf6, idx: 0x0},
+ 718: {cur: 0xfc, idx: 0x0},
+ 719: {cur: 0x105, idx: 0x0},
+ 720: {cur: 0x109, idx: 0x0},
+ 721: {cur: 0x110, idx: 0x0},
+ 722: {cur: 0x117, idx: 0x0},
+ 723: {cur: 0xbf, idx: 0x4e4},
+ 724: {cur: 0xeb, idx: 0xbc},
+ 725: {cur: 0x13, idx: 0xf8},
+ 726: {cur: 0x3a, idx: 0x9b},
+ 727: {cur: 0x60, idx: 0x16e},
+ 728: {cur: 0xd6, idx: 0x28a},
+ 729: {cur: 0xeb, idx: 0xbc},
+ 730: {cur: 0x117, idx: 0x0},
+ 731: {cur: 0x14, idx: 0x4f8},
+ 732: {cur: 0xfc, idx: 0x4},
+ 733: {cur: 0x8, idx: 0x36d},
+ 734: {cur: 0xe2, idx: 0x4},
+ 735: {cur: 0x8, idx: 0x36d},
+ 736: {cur: 0x13, idx: 0x0},
+ 737: {cur: 0x2e, idx: 0x0},
+ 738: {cur: 0x3a, idx: 0x0},
+ 739: {cur: 0x44, idx: 0x0},
+ 740: {cur: 0x63, idx: 0x0},
+ 741: {cur: 0x72, idx: 0x0},
+ 742: {cur: 0x7c, idx: 0x0},
+ 743: {cur: 0x7d, idx: 0x0},
+ 744: {cur: 0x85, idx: 0x0},
+ 745: {cur: 0x8d, idx: 0x0},
+ 746: {cur: 0xb2, idx: 0x0},
+ 747: {cur: 0xbe, idx: 0x30},
+ 748: {cur: 0xc0, idx: 0x0},
+ 749: {cur: 0xf6, idx: 0x0},
+ 750: {cur: 0xfc, idx: 0x0},
+ 751: {cur: 0x105, idx: 0x0},
+ 752: {cur: 0x109, idx: 0x0},
+ 753: {cur: 0x110, idx: 0x0},
+ 754: {cur: 0x117, idx: 0x0},
+ 755: {cur: 0x63, idx: 0x237},
+ 756: {cur: 0xe4, idx: 0x3f},
+ 757: {cur: 0xfb, idx: 0x2f4},
+ 758: {cur: 0x5d, idx: 0x258},
+ 759: {cur: 0x86, idx: 0x308},
+ 760: {cur: 0x85, idx: 0x25},
+ 761: {cur: 0xfc, idx: 0x4},
+ 762: {cur: 0x65, idx: 0x42},
+ 763: {cur: 0xfc, idx: 0x4},
+ 764: {cur: 0x65, idx: 0x0},
+ 765: {cur: 0xd2, idx: 0xb2},
+ 766: {cur: 0xeb, idx: 0xbc},
+ 767: {cur: 0xc8, idx: 0x4fd},
+ 768: {cur: 0x13, idx: 0x0},
+ 769: {cur: 0x3a, idx: 0x0},
+ 770: {cur: 0x44, idx: 0x0},
+ 771: {cur: 0x63, idx: 0x0},
+ 772: {cur: 0x72, idx: 0x0},
+ 773: {cur: 0x7c, idx: 0x0},
+ 774: {cur: 0x7d, idx: 0x0},
+ 775: {cur: 0x85, idx: 0x0},
+ 776: {cur: 0x8d, idx: 0x0},
+ 777: {cur: 0xb2, idx: 0x0},
+ 778: {cur: 0xc0, idx: 0x0},
+ 779: {cur: 0xc9, idx: 0xa6},
+ 780: {cur: 0xf6, idx: 0x0},
+ 781: {cur: 0xfc, idx: 0x0},
+ 782: {cur: 0x105, idx: 0x0},
+ 783: {cur: 0x4, idx: 0x396},
+ 784: {cur: 0x13, idx: 0xf8},
+ 785: {cur: 0xcb, idx: 0x504},
+ 786: {cur: 0xeb, idx: 0xbc},
+ 787: {cur: 0x9, idx: 0x1},
+ 788: {cur: 0x4c, idx: 0x4ae},
+ 789: {cur: 0xcb, idx: 0x509},
+ 790: {cur: 0x99, idx: 0x2eb},
+ 791: {cur: 0xaa, idx: 0x35f},
+ 792: {cur: 0xb8, idx: 0x4cc},
+ 793: {cur: 0xcb, idx: 0x4ae},
+ 794: {cur: 0xe5, idx: 0xb9},
+ 795: {cur: 0xc4, idx: 0x38b},
+ 796: {cur: 0x27, idx: 0x10},
+ 797: {cur: 0xc4, idx: 0x0},
+ 798: {cur: 0xc4, idx: 0x0},
+ 799: {cur: 0xfc, idx: 0x4},
+ 800: {cur: 0x24, idx: 0x359},
+ 801: {cur: 0x13, idx: 0x0},
+ 802: {cur: 0x2e, idx: 0x0},
+ 803: {cur: 0x3a, idx: 0x0},
+ 804: {cur: 0x44, idx: 0x0},
+ 805: {cur: 0x5e, idx: 0x0},
+ 806: {cur: 0x63, idx: 0x0},
+ 807: {cur: 0x72, idx: 0x0},
+ 808: {cur: 0x7c, idx: 0x0},
+ 809: {cur: 0x7d, idx: 0x0},
+ 810: {cur: 0x85, idx: 0x0},
+ 811: {cur: 0x8d, idx: 0x0},
+ 812: {cur: 0xb2, idx: 0x0},
+ 813: {cur: 0xc0, idx: 0x0},
+ 814: {cur: 0xf6, idx: 0x0},
+ 815: {cur: 0xfc, idx: 0x0},
+ 816: {cur: 0x105, idx: 0x0},
+ 817: {cur: 0x110, idx: 0x0},
+ 818: {cur: 0xa2, idx: 0x4f},
+ 819: {cur: 0xf7, idx: 0x23c},
+ 820: {cur: 0x0, idx: 0x510},
+ 821: {cur: 0x85, idx: 0x25},
+ 822: {cur: 0xd2, idx: 0xb2},
+ 823: {cur: 0xd3, idx: 0x18},
+ 824: {cur: 0xeb, idx: 0xbc},
+ 825: {cur: 0xef, idx: 0x519},
+ 826: {cur: 0xf8, idx: 0xcb},
+ 827: {cur: 0xfc, idx: 0x4},
+ 828: {cur: 0x37, idx: 0x258},
+ 829: {cur: 0xd3, idx: 0x0},
+ 830: {cur: 0x87, idx: 0x4bf},
+ 831: {cur: 0x90, idx: 0x72},
+ 832: {cur: 0xa2, idx: 0x4f},
+ 833: {cur: 0xd4, idx: 0xb6},
+ 834: {cur: 0xf7, idx: 0x23c},
+ 835: {cur: 0xd2, idx: 0xb2},
+ 836: {cur: 0x86, idx: 0x308},
+ 837: {cur: 0xf7, idx: 0x23c},
+ 838: {cur: 0xc8, idx: 0x7e},
+ 839: {cur: 0x52, idx: 0x520},
+ 840: {cur: 0xbe, idx: 0x30},
+ 841: {cur: 0xdb, idx: 0x524},
+ 842: {cur: 0xeb, idx: 0xbc},
+ 843: {cur: 0xbe, idx: 0x528},
+ 844: {cur: 0xdb, idx: 0x30},
+ 845: {cur: 0xb8, idx: 0x4cc},
+ 846: {cur: 0x93, idx: 0x52c},
+ 847: {cur: 0xeb, idx: 0xbc},
+ 848: {cur: 0x115, idx: 0x534},
+ 849: {cur: 0x13, idx: 0x0},
+ 850: {cur: 0x2e, idx: 0x0},
+ 851: {cur: 0x3a, idx: 0x0},
+ 852: {cur: 0x44, idx: 0x0},
+ 853: {cur: 0x63, idx: 0x0},
+ 854: {cur: 0x72, idx: 0x0},
+ 855: {cur: 0x7c, idx: 0x544},
+ 856: {cur: 0x7d, idx: 0x0},
+ 857: {cur: 0x85, idx: 0x0},
+ 858: {cur: 0x8d, idx: 0x0},
+ 859: {cur: 0xc0, idx: 0x0},
+ 860: {cur: 0xf6, idx: 0x0},
+ 861: {cur: 0xfc, idx: 0x0},
+ 862: {cur: 0x105, idx: 0x0},
+ 863: {cur: 0x13, idx: 0x0},
+ 864: {cur: 0x2e, idx: 0x0},
+ 865: {cur: 0x3a, idx: 0x0},
+ 866: {cur: 0x63, idx: 0x0},
+ 867: {cur: 0x85, idx: 0x25},
+ 868: {cur: 0xb2, idx: 0x0},
+ 869: {cur: 0xc0, idx: 0x0},
+ 870: {cur: 0xf6, idx: 0x0},
+ 871: {cur: 0xfc, idx: 0x4},
+ 872: {cur: 0x110, idx: 0x0},
+ 873: {cur: 0xe1, idx: 0x235},
+ 874: {cur: 0x51, idx: 0x22d},
+ 875: {cur: 0x5d, idx: 0x258},
+ 876: {cur: 0x86, idx: 0x308},
+ 877: {cur: 0x6, idx: 0x548},
+ 878: {cur: 0xeb, idx: 0xbc},
+ 879: {cur: 0xa5, idx: 0x54e},
+ 880: {cur: 0x13, idx: 0x0},
+ 881: {cur: 0x18, idx: 0x2cf},
+ 882: {cur: 0x85, idx: 0x25},
+ 883: {cur: 0x8d, idx: 0x0},
+ 884: {cur: 0xc0, idx: 0x0},
+ 885: {cur: 0x105, idx: 0x0},
+ 886: {cur: 0x13, idx: 0x0},
+ 887: {cur: 0x18, idx: 0x9},
+ 888: {cur: 0x85, idx: 0x25},
+ 889: {cur: 0x8d, idx: 0x0},
+ 890: {cur: 0xc0, idx: 0x0},
+ 891: {cur: 0x105, idx: 0x0},
+ 892: {cur: 0x13, idx: 0x0},
+ 893: {cur: 0x1a, idx: 0x24c},
+ 894: {cur: 0x25, idx: 0x13a},
+ 895: {cur: 0x2e, idx: 0x555},
+ 896: {cur: 0x32, idx: 0x142},
+ 897: {cur: 0x39, idx: 0x146},
+ 898: {cur: 0x44, idx: 0x0},
+ 899: {cur: 0x52, idx: 0x520},
+ 900: {cur: 0x53, idx: 0x264},
+ 901: {cur: 0x57, idx: 0x559},
+ 902: {cur: 0x58, idx: 0x55d},
+ 903: {cur: 0x63, idx: 0x0},
+ 904: {cur: 0x72, idx: 0x0},
+ 905: {cur: 0x79, idx: 0x562},
+ 906: {cur: 0x7d, idx: 0x0},
+ 907: {cur: 0x81, idx: 0x567},
+ 908: {cur: 0x83, idx: 0x18c},
+ 909: {cur: 0x85, idx: 0x0},
+ 910: {cur: 0x8d, idx: 0x0},
+ 911: {cur: 0xbe, idx: 0x528},
+ 912: {cur: 0xc0, idx: 0x0},
+ 913: {cur: 0xdb, idx: 0x30},
+ 914: {cur: 0xf6, idx: 0x0},
+ 915: {cur: 0x105, idx: 0x0},
+ 916: {cur: 0x86, idx: 0x308},
+ 917: {cur: 0xeb, idx: 0xbc},
+ 918: {cur: 0xf7, idx: 0x23c},
+ 919: {cur: 0x3b, idx: 0x32a},
+ 920: {cur: 0xfb, idx: 0x2f4},
+ 921: {cur: 0x85, idx: 0x25},
+ 922: {cur: 0xeb, idx: 0xbc},
+ 923: {cur: 0xfc, idx: 0x4},
+ 924: {cur: 0x93, idx: 0x56b},
+ 925: {cur: 0xb5, idx: 0x94},
+ 926: {cur: 0xdc, idx: 0x28e},
+ 927: {cur: 0xb5, idx: 0x94},
+ 928: {cur: 0xdc, idx: 0x4},
+ 929: {cur: 0xfc, idx: 0xcf},
+ 930: {cur: 0xeb, idx: 0xbc},
+ 931: {cur: 0xfc, idx: 0x4},
+ 932: {cur: 0xfb, idx: 0x2f4},
+ 933: {cur: 0x86, idx: 0x308},
+ 934: {cur: 0xed, idx: 0x56f},
+ 935: {cur: 0xfc, idx: 0x4},
+ 936: {cur: 0x13, idx: 0xf8},
+ 937: {cur: 0x85, idx: 0x25},
+ 938: {cur: 0x5d, idx: 0x258},
+ 939: {cur: 0x59, idx: 0x231},
+ 940: {cur: 0x5e, idx: 0x0},
+ 941: {cur: 0x63, idx: 0x0},
+ 942: {cur: 0x13, idx: 0x577},
+ 943: {cur: 0xc0, idx: 0x57c},
+ 944: {cur: 0xf1, idx: 0xc0},
+ 945: {cur: 0x13, idx: 0xf8},
+ 946: {cur: 0x85, idx: 0x25},
+ 947: {cur: 0xeb, idx: 0xbc},
+ 948: {cur: 0xf4, idx: 0xc3},
+ 949: {cur: 0xfc, idx: 0x4},
+ 950: {cur: 0xd2, idx: 0xb2},
+ 951: {cur: 0xfc, idx: 0x4},
+ 952: {cur: 0x44, idx: 0x4a3},
+ 953: {cur: 0xfc, idx: 0x4},
+ 954: {cur: 0x13, idx: 0x0},
+ 955: {cur: 0x2e, idx: 0x0},
+ 956: {cur: 0x3a, idx: 0x0},
+ 957: {cur: 0x44, idx: 0x0},
+ 958: {cur: 0x5e, idx: 0x0},
+ 959: {cur: 0x63, idx: 0x0},
+ 960: {cur: 0x72, idx: 0x0},
+ 961: {cur: 0x7c, idx: 0x0},
+ 962: {cur: 0x7d, idx: 0x0},
+ 963: {cur: 0x85, idx: 0x25},
+ 964: {cur: 0x8d, idx: 0x0},
+ 965: {cur: 0xb2, idx: 0x0},
+ 966: {cur: 0xc0, idx: 0x0},
+ 967: {cur: 0xf6, idx: 0x0},
+ 968: {cur: 0xf8, idx: 0xcb},
+ 969: {cur: 0xf9, idx: 0x581},
+ 970: {cur: 0xfc, idx: 0x0},
+ 971: {cur: 0x105, idx: 0x0},
+ 972: {cur: 0x110, idx: 0x0},
+ 973: {cur: 0xc8, idx: 0x7e},
+ 974: {cur: 0xeb, idx: 0xbc},
+ 975: {cur: 0xfc, idx: 0x4},
+ 976: {cur: 0xc8, idx: 0x0},
+ 977: {cur: 0x102, idx: 0x589},
+ 978: {cur: 0x4, idx: 0x396},
+ 979: {cur: 0xeb, idx: 0xbc},
+ 980: {cur: 0x102, idx: 0x58f},
+ 981: {cur: 0x94, idx: 0x4},
+ 982: {cur: 0x94, idx: 0x4},
+ 983: {cur: 0x13, idx: 0xf8},
+ 984: {cur: 0xeb, idx: 0xbc},
+ 985: {cur: 0xf7, idx: 0x23c},
+ 986: {cur: 0x85, idx: 0x25},
+ 987: {cur: 0xfc, idx: 0x4},
+ 988: {cur: 0xfc, idx: 0x4},
+ 989: {cur: 0xfb, idx: 0x2f4},
+ 990: {cur: 0xba, idx: 0x97},
+ 991: {cur: 0x13, idx: 0xf8},
+ 992: {cur: 0x85, idx: 0x25},
+ 993: {cur: 0x8d, idx: 0x596},
+ 994: {cur: 0x13, idx: 0xf8},
+ 995: {cur: 0x44, idx: 0x4a3},
+ 996: {cur: 0x8d, idx: 0x596},
+ 997: {cur: 0x13, idx: 0xf8},
+ 998: {cur: 0x44, idx: 0x4a3},
+ 999: {cur: 0x7b, idx: 0x59a},
+ 1000: {cur: 0x8d, idx: 0x596},
+ 1001: {cur: 0x44, idx: 0x20},
+ 1002: {cur: 0x44, idx: 0x20},
+ 1003: {cur: 0xaa, idx: 0x35f},
+ 1004: {cur: 0x44, idx: 0x20},
+ 1005: {cur: 0xdc, idx: 0x4},
+ 1006: {cur: 0x13, idx: 0xf8},
+ 1007: {cur: 0x85, idx: 0x25},
+ 1008: {cur: 0x8d, idx: 0x596},
+ 1009: {cur: 0xf6, idx: 0x4},
+ 1010: {cur: 0x8d, idx: 0x6e},
+ 1011: {cur: 0xf6, idx: 0xc7},
+ 1012: {cur: 0xaa, idx: 0x35f},
+ 1013: {cur: 0xeb, idx: 0xbc},
+ 1014: {cur: 0x125, idx: 0xe9},
+} // Size: 4084 bytes
+
+var narrowLangIndex = []uint16{ // 776 elements
+ // Entry 0 - 3F
+ 0x0000, 0x0062, 0x0064, 0x0064, 0x0064, 0x0064, 0x0064, 0x0064,
+ 0x0064, 0x0065, 0x0065, 0x0081, 0x0081, 0x0082, 0x0082, 0x0082,
+ 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082,
+ 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082,
+ 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x0082,
+ 0x0082, 0x0082, 0x0082, 0x0082, 0x0082, 0x008b, 0x008b, 0x008e,
+ 0x008e, 0x008e, 0x008e, 0x008e, 0x008e, 0x008e, 0x00a8, 0x00a8,
+ 0x00a8, 0x00a8, 0x00a8, 0x00a8, 0x00d8, 0x00d8, 0x00d8, 0x00d8,
+ // Entry 40 - 7F
+ 0x00d8, 0x00d9, 0x00d9, 0x00d9, 0x00d9, 0x00d9, 0x00d9, 0x00dc,
+ 0x00dc, 0x00dc, 0x00dc, 0x00dd, 0x00dd, 0x00dd, 0x00dd, 0x00dd,
+ 0x00de, 0x00de, 0x00de, 0x00de, 0x00de, 0x00df, 0x00df, 0x00df,
+ 0x00e0, 0x00e0, 0x00e0, 0x00e0, 0x00e0, 0x00e0, 0x00e0, 0x00e0,
+ 0x00e0, 0x00e2, 0x00e2, 0x00e2, 0x00e2, 0x00e8, 0x00e8, 0x00ee,
+ 0x00ee, 0x00ee, 0x00ee, 0x00ee, 0x00f7, 0x00f7, 0x00f7, 0x00f8,
+ 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8,
+ 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8,
+ // Entry 80 - BF
+ 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8,
+ 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x00f8, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ // Entry C0 - FF
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0103, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108,
+ 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108,
+ // Entry 100 - 13F
+ 0x0108, 0x0108, 0x0108, 0x0108, 0x010d, 0x010d, 0x010d, 0x010d,
+ 0x010d, 0x010d, 0x010d, 0x010d, 0x0111, 0x0111, 0x0112, 0x0113,
+ 0x0113, 0x0114, 0x0114, 0x0114, 0x0114, 0x0114, 0x0114, 0x0114,
+ 0x0114, 0x0114, 0x0114, 0x0114, 0x0114, 0x0171, 0x0171, 0x0172,
+ 0x0172, 0x0172, 0x0172, 0x0172, 0x017a, 0x017a, 0x017a, 0x017a,
+ 0x017a, 0x017a, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f,
+ 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f,
+ 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f,
+ // Entry 140 - 17F
+ 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f,
+ 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f,
+ 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x017f, 0x0180,
+ 0x0180, 0x0182, 0x0182, 0x0185, 0x0185, 0x0185, 0x0185, 0x0185,
+ 0x0185, 0x0187, 0x0187, 0x0187, 0x0187, 0x0187, 0x0187, 0x0187,
+ 0x0187, 0x0187, 0x0187, 0x0187, 0x0187, 0x0187, 0x0188, 0x0188,
+ 0x018a, 0x018a, 0x018b, 0x018b, 0x018b, 0x018b, 0x018b, 0x018c,
+ 0x018c, 0x018d, 0x018d, 0x018e, 0x018e, 0x018e, 0x018e, 0x018e,
+ // Entry 180 - 1BF
+ 0x018e, 0x018e, 0x018e, 0x018f, 0x018f, 0x0193, 0x0193, 0x0193,
+ 0x0193, 0x0193, 0x0193, 0x0193, 0x0196, 0x0196, 0x0196, 0x0196,
+ 0x0196, 0x0196, 0x0196, 0x0196, 0x0196, 0x0196, 0x0197, 0x0197,
+ 0x0197, 0x0197, 0x0197, 0x0197, 0x0197, 0x0197, 0x0197, 0x0197,
+ 0x0197, 0x0197, 0x0197, 0x0197, 0x0197, 0x0197, 0x0198, 0x0198,
+ 0x0198, 0x0198, 0x0198, 0x0198, 0x0198, 0x0198, 0x0199, 0x0199,
+ 0x019b, 0x019b, 0x019d, 0x019d, 0x019d, 0x019d, 0x019d, 0x019d,
+ 0x019d, 0x019d, 0x019d, 0x019d, 0x019d, 0x019d, 0x019d, 0x019d,
+ // Entry 1C0 - 1FF
+ 0x019d, 0x019d, 0x01a8, 0x01a8, 0x01a8, 0x01a8, 0x01a9, 0x01a9,
+ 0x01a9, 0x01a9, 0x01a9, 0x01a9, 0x01a9, 0x01a9, 0x01a9, 0x01a9,
+ 0x01a9, 0x01aa, 0x01aa, 0x01aa, 0x01aa, 0x01aa, 0x01b5, 0x01b5,
+ 0x01b5, 0x01b5, 0x01b5, 0x01b5, 0x01b5, 0x01b5, 0x01b6, 0x01b6,
+ 0x01b6, 0x01b6, 0x01b6, 0x01b6, 0x01b6, 0x01b6, 0x01b6, 0x01b6,
+ 0x01b6, 0x01b6, 0x01b6, 0x01b6, 0x01b6, 0x01b7, 0x01b7, 0x01b8,
+ 0x01b8, 0x01ba, 0x01ba, 0x01ba, 0x01bb, 0x01bb, 0x01bc, 0x01bc,
+ 0x01bc, 0x01bc, 0x01bc, 0x01bc, 0x01bc, 0x01bc, 0x01be, 0x01be,
+ // Entry 200 - 23F
+ 0x01be, 0x01be, 0x01be, 0x01be, 0x01be, 0x01c0, 0x01c0, 0x01c0,
+ 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c1, 0x01c1, 0x01c1,
+ 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2,
+ 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2,
+ 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2,
+ 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c2, 0x01c3,
+ 0x01c3, 0x01c3, 0x01c3, 0x01c3, 0x01c3, 0x01c5, 0x01c5, 0x01c5,
+ 0x01c5, 0x01c5, 0x01c5, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7,
+ // Entry 240 - 27F
+ 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7,
+ 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7, 0x01c7,
+ 0x01c8, 0x01c8, 0x01c8, 0x01c8, 0x01c8, 0x01cb, 0x01cc, 0x01cc,
+ 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc,
+ 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc,
+ 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc,
+ 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc, 0x01cc,
+ 0x01cc, 0x01ce, 0x01ce, 0x01cf, 0x01cf, 0x01d0, 0x01d0, 0x01d0,
+ // Entry 280 - 2BF
+ 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
+ 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
+ 0x01d2, 0x01d2, 0x01d2, 0x01d2, 0x01d2, 0x01d2, 0x01d5, 0x01d5,
+ 0x01d5, 0x01d5, 0x01d5, 0x01d5, 0x01d5, 0x01d5, 0x01d8, 0x01d8,
+ 0x01d8, 0x01d8, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
+ 0x01da, 0x01da, 0x01da, 0x01da, 0x01da, 0x01db, 0x01db, 0x01db,
+ 0x01db, 0x01db, 0x01db, 0x01db, 0x01dc, 0x01dc, 0x01dc, 0x01dc,
+ 0x01dc, 0x01dc, 0x01dc, 0x01dc, 0x01dc, 0x01dc, 0x01dc, 0x01dc,
+ // Entry 2C0 - 2FF
+ 0x01de, 0x01de, 0x01de, 0x01de, 0x01de, 0x01de, 0x01de, 0x01de,
+ 0x01de, 0x01de, 0x01de, 0x01de, 0x01df, 0x01df, 0x01e0, 0x01e0,
+ 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e0,
+ 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e0, 0x01e1, 0x01e1,
+ 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1,
+ 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1,
+ 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1, 0x01e1,
+ 0x01e1, 0x01e1, 0x01e2, 0x01e2, 0x01e2, 0x01e2, 0x01e2, 0x01e2,
+ // Entry 300 - 33F
+ 0x01e3, 0x01e3, 0x01e3, 0x01e3, 0x01eb, 0x01eb, 0x01eb, 0x01eb,
+} // Size: 1576 bytes
+
+var narrowSymIndex = []curToIndex{ // 491 elements
+ 0: {cur: 0x9, idx: 0x1},
+ 1: {cur: 0x11, idx: 0x4},
+ 2: {cur: 0x13, idx: 0x4},
+ 3: {cur: 0x18, idx: 0x9},
+ 4: {cur: 0x1a, idx: 0x4},
+ 5: {cur: 0x1b, idx: 0xc},
+ 6: {cur: 0x25, idx: 0x4},
+ 7: {cur: 0x26, idx: 0x4},
+ 8: {cur: 0x27, idx: 0x10},
+ 9: {cur: 0x2e, idx: 0x13},
+ 10: {cur: 0x32, idx: 0x4},
+ 11: {cur: 0x35, idx: 0x16},
+ 12: {cur: 0x37, idx: 0x18},
+ 13: {cur: 0x39, idx: 0x4},
+ 14: {cur: 0x3a, idx: 0x4},
+ 15: {cur: 0x41, idx: 0x4},
+ 16: {cur: 0x44, idx: 0x25},
+ 17: {cur: 0x45, idx: 0x4},
+ 18: {cur: 0x47, idx: 0x28},
+ 19: {cur: 0x4a, idx: 0x4},
+ 20: {cur: 0x4b, idx: 0x4},
+ 21: {cur: 0x4e, idx: 0x2c},
+ 22: {cur: 0x52, idx: 0x30},
+ 23: {cur: 0x53, idx: 0x4},
+ 24: {cur: 0x58, idx: 0x33},
+ 25: {cur: 0x5c, idx: 0x37},
+ 26: {cur: 0x5e, idx: 0x3b},
+ 27: {cur: 0x60, idx: 0x4},
+ 28: {cur: 0x61, idx: 0x3f},
+ 29: {cur: 0x63, idx: 0x3f},
+ 30: {cur: 0x65, idx: 0x42},
+ 31: {cur: 0x68, idx: 0x3f},
+ 32: {cur: 0x6a, idx: 0x46},
+ 33: {cur: 0x6e, idx: 0x49},
+ 34: {cur: 0x71, idx: 0x4},
+ 35: {cur: 0x72, idx: 0x4},
+ 36: {cur: 0x73, idx: 0x4f},
+ 37: {cur: 0x75, idx: 0x51},
+ 38: {cur: 0x77, idx: 0x54},
+ 39: {cur: 0x78, idx: 0x57},
+ 40: {cur: 0x7c, idx: 0x5a},
+ 41: {cur: 0x7d, idx: 0x5e},
+ 42: {cur: 0x81, idx: 0x30},
+ 43: {cur: 0x83, idx: 0x4},
+ 44: {cur: 0x85, idx: 0x25},
+ 45: {cur: 0x88, idx: 0x67},
+ 46: {cur: 0x89, idx: 0x6b},
+ 47: {cur: 0x8a, idx: 0x6e},
+ 48: {cur: 0x8d, idx: 0x6e},
+ 49: {cur: 0x8f, idx: 0x4},
+ 50: {cur: 0x90, idx: 0x72},
+ 51: {cur: 0x91, idx: 0x76},
+ 52: {cur: 0x92, idx: 0x7a},
+ 53: {cur: 0x93, idx: 0x7e},
+ 54: {cur: 0x94, idx: 0x4},
+ 55: {cur: 0x96, idx: 0x81},
+ 56: {cur: 0x9b, idx: 0x84},
+ 57: {cur: 0xa3, idx: 0x87},
+ 58: {cur: 0xa8, idx: 0x8a},
+ 59: {cur: 0xa9, idx: 0x8c},
+ 60: {cur: 0xae, idx: 0x7e},
+ 61: {cur: 0xb2, idx: 0x4},
+ 62: {cur: 0xb5, idx: 0x94},
+ 63: {cur: 0xb9, idx: 0x4},
+ 64: {cur: 0xba, idx: 0x97},
+ 65: {cur: 0xbc, idx: 0x9b},
+ 66: {cur: 0xbe, idx: 0x30},
+ 67: {cur: 0xbf, idx: 0x7e},
+ 68: {cur: 0xc0, idx: 0x4},
+ 69: {cur: 0xc7, idx: 0xa2},
+ 70: {cur: 0xc8, idx: 0x7e},
+ 71: {cur: 0xc9, idx: 0xa6},
+ 72: {cur: 0xcc, idx: 0xaa},
+ 73: {cur: 0xd0, idx: 0xae},
+ 74: {cur: 0xd2, idx: 0xb2},
+ 75: {cur: 0xd3, idx: 0x18},
+ 76: {cur: 0xd4, idx: 0xb6},
+ 77: {cur: 0xd6, idx: 0x4},
+ 78: {cur: 0xdb, idx: 0x30},
+ 79: {cur: 0xdc, idx: 0x4},
+ 80: {cur: 0xdd, idx: 0x3f},
+ 81: {cur: 0xe2, idx: 0x4},
+ 82: {cur: 0xe4, idx: 0x3f},
+ 83: {cur: 0xe5, idx: 0xb9},
+ 84: {cur: 0xe9, idx: 0x3f},
+ 85: {cur: 0xeb, idx: 0xbc},
+ 86: {cur: 0xf1, idx: 0xc0},
+ 87: {cur: 0xf4, idx: 0xc3},
+ 88: {cur: 0xf5, idx: 0x4},
+ 89: {cur: 0xf6, idx: 0x4},
+ 90: {cur: 0xf8, idx: 0xcb},
+ 91: {cur: 0xfc, idx: 0x4},
+ 92: {cur: 0x101, idx: 0x4},
+ 93: {cur: 0x104, idx: 0x10},
+ 94: {cur: 0x105, idx: 0xd3},
+ 95: {cur: 0x110, idx: 0x4},
+ 96: {cur: 0x125, idx: 0xe9},
+ 97: {cur: 0x127, idx: 0xeb},
+ 98: {cur: 0xd0, idx: 0xee},
+ 99: {cur: 0xf6, idx: 0xc7},
+ 100: {cur: 0xf6, idx: 0xc7},
+ 101: {cur: 0x11, idx: 0x128},
+ 102: {cur: 0x13, idx: 0xf8},
+ 103: {cur: 0x1a, idx: 0x12c},
+ 104: {cur: 0x25, idx: 0x13a},
+ 105: {cur: 0x26, idx: 0x13e},
+ 106: {cur: 0x32, idx: 0x142},
+ 107: {cur: 0x39, idx: 0x146},
+ 108: {cur: 0x3a, idx: 0x1c},
+ 109: {cur: 0x41, idx: 0x14a},
+ 110: {cur: 0x44, idx: 0x20},
+ 111: {cur: 0x45, idx: 0x14e},
+ 112: {cur: 0x4b, idx: 0x152},
+ 113: {cur: 0x53, idx: 0x156},
+ 114: {cur: 0x60, idx: 0x16e},
+ 115: {cur: 0x63, idx: 0x172},
+ 116: {cur: 0x71, idx: 0x177},
+ 117: {cur: 0x72, idx: 0x4b},
+ 118: {cur: 0x83, idx: 0x18c},
+ 119: {cur: 0x85, idx: 0x62},
+ 120: {cur: 0x8f, idx: 0x1a4},
+ 121: {cur: 0xb2, idx: 0x90},
+ 122: {cur: 0xc0, idx: 0x9e},
+ 123: {cur: 0xd6, idx: 0x1ee},
+ 124: {cur: 0xe2, idx: 0x203},
+ 125: {cur: 0xf5, idx: 0x21b},
+ 126: {cur: 0xf6, idx: 0xc7},
+ 127: {cur: 0xfc, idx: 0xcf},
+ 128: {cur: 0x101, idx: 0x21f},
+ 129: {cur: 0x26, idx: 0x4},
+ 130: {cur: 0x37, idx: 0x0},
+ 131: {cur: 0x52, idx: 0x0},
+ 132: {cur: 0x75, idx: 0x0},
+ 133: {cur: 0x81, idx: 0x0},
+ 134: {cur: 0xbe, idx: 0x0},
+ 135: {cur: 0xc9, idx: 0x0},
+ 136: {cur: 0xd3, idx: 0x0},
+ 137: {cur: 0xdb, idx: 0x0},
+ 138: {cur: 0xf6, idx: 0xc7},
+ 139: {cur: 0xd0, idx: 0x244},
+ 140: {cur: 0xe9, idx: 0x248},
+ 141: {cur: 0xf6, idx: 0xc7},
+ 142: {cur: 0x13, idx: 0x6},
+ 143: {cur: 0x1a, idx: 0x24c},
+ 144: {cur: 0x25, idx: 0x251},
+ 145: {cur: 0x32, idx: 0x255},
+ 146: {cur: 0x37, idx: 0x258},
+ 147: {cur: 0x39, idx: 0x146},
+ 148: {cur: 0x3a, idx: 0x1c},
+ 149: {cur: 0x4a, idx: 0x25b},
+ 150: {cur: 0x4b, idx: 0x260},
+ 151: {cur: 0x53, idx: 0x264},
+ 152: {cur: 0x60, idx: 0x16e},
+ 153: {cur: 0x61, idx: 0x268},
+ 154: {cur: 0x71, idx: 0x26d},
+ 155: {cur: 0x81, idx: 0x270},
+ 156: {cur: 0x83, idx: 0x275},
+ 157: {cur: 0x8f, idx: 0x278},
+ 158: {cur: 0x94, idx: 0x27c},
+ 159: {cur: 0xb2, idx: 0x90},
+ 160: {cur: 0xb9, idx: 0x27f},
+ 161: {cur: 0xc0, idx: 0x9e},
+ 162: {cur: 0xd2, idx: 0x282},
+ 163: {cur: 0xd6, idx: 0x28a},
+ 164: {cur: 0xdc, idx: 0x28e},
+ 165: {cur: 0xf5, idx: 0x21b},
+ 166: {cur: 0x101, idx: 0x291},
+ 167: {cur: 0x110, idx: 0xdc},
+ 168: {cur: 0x11, idx: 0x0},
+ 169: {cur: 0x13, idx: 0x0},
+ 170: {cur: 0x1a, idx: 0x0},
+ 171: {cur: 0x1b, idx: 0x0},
+ 172: {cur: 0x25, idx: 0x0},
+ 173: {cur: 0x26, idx: 0x0},
+ 174: {cur: 0x2e, idx: 0x0},
+ 175: {cur: 0x32, idx: 0x0},
+ 176: {cur: 0x37, idx: 0x0},
+ 177: {cur: 0x39, idx: 0x0},
+ 178: {cur: 0x3a, idx: 0x0},
+ 179: {cur: 0x41, idx: 0x0},
+ 180: {cur: 0x44, idx: 0x0},
+ 181: {cur: 0x45, idx: 0x0},
+ 182: {cur: 0x47, idx: 0x0},
+ 183: {cur: 0x4b, idx: 0x0},
+ 184: {cur: 0x53, idx: 0x0},
+ 185: {cur: 0x60, idx: 0x0},
+ 186: {cur: 0x68, idx: 0x0},
+ 187: {cur: 0x71, idx: 0x0},
+ 188: {cur: 0x72, idx: 0x0},
+ 189: {cur: 0x7c, idx: 0x0},
+ 190: {cur: 0x7d, idx: 0x0},
+ 191: {cur: 0x83, idx: 0x0},
+ 192: {cur: 0x88, idx: 0x0},
+ 193: {cur: 0x8d, idx: 0x0},
+ 194: {cur: 0x8f, idx: 0x0},
+ 195: {cur: 0x90, idx: 0x0},
+ 196: {cur: 0x91, idx: 0x0},
+ 197: {cur: 0x94, idx: 0x0},
+ 198: {cur: 0xa9, idx: 0x0},
+ 199: {cur: 0xb2, idx: 0x0},
+ 200: {cur: 0xb9, idx: 0x0},
+ 201: {cur: 0xba, idx: 0x0},
+ 202: {cur: 0xc0, idx: 0x0},
+ 203: {cur: 0xc7, idx: 0x0},
+ 204: {cur: 0xcc, idx: 0x0},
+ 205: {cur: 0xd0, idx: 0x0},
+ 206: {cur: 0xd6, idx: 0x0},
+ 207: {cur: 0xdc, idx: 0x0},
+ 208: {cur: 0xe2, idx: 0x0},
+ 209: {cur: 0xe4, idx: 0x0},
+ 210: {cur: 0xf4, idx: 0x0},
+ 211: {cur: 0xf5, idx: 0x0},
+ 212: {cur: 0xf6, idx: 0x0},
+ 213: {cur: 0xf8, idx: 0x0},
+ 214: {cur: 0x101, idx: 0x0},
+ 215: {cur: 0x105, idx: 0x0},
+ 216: {cur: 0xf6, idx: 0xc7},
+ 217: {cur: 0x58, idx: 0x2a8},
+ 218: {cur: 0x92, idx: 0x2b8},
+ 219: {cur: 0xf1, idx: 0x2c1},
+ 220: {cur: 0xf6, idx: 0xc7},
+ 221: {cur: 0x104, idx: 0x0},
+ 222: {cur: 0xf6, idx: 0xc7},
+ 223: {cur: 0xd0, idx: 0x2ed},
+ 224: {cur: 0xd0, idx: 0x4f},
+ 225: {cur: 0xf6, idx: 0xc7},
+ 226: {cur: 0x1b, idx: 0x301},
+ 227: {cur: 0x35, idx: 0x0},
+ 228: {cur: 0x72, idx: 0x4b},
+ 229: {cur: 0xf6, idx: 0xc7},
+ 230: {cur: 0x125, idx: 0x0},
+ 231: {cur: 0x127, idx: 0x0},
+ 232: {cur: 0x52, idx: 0x304},
+ 233: {cur: 0x81, idx: 0x304},
+ 234: {cur: 0xbe, idx: 0x304},
+ 235: {cur: 0xd0, idx: 0x4f},
+ 236: {cur: 0xdb, idx: 0x304},
+ 237: {cur: 0xf6, idx: 0xc7},
+ 238: {cur: 0x4a, idx: 0x318},
+ 239: {cur: 0x61, idx: 0x320},
+ 240: {cur: 0x6a, idx: 0x325},
+ 241: {cur: 0x89, idx: 0x32a},
+ 242: {cur: 0xd0, idx: 0x4f},
+ 243: {cur: 0xd4, idx: 0x32d},
+ 244: {cur: 0xe9, idx: 0x0},
+ 245: {cur: 0xf6, idx: 0xc7},
+ 246: {cur: 0x127, idx: 0x8a},
+ 247: {cur: 0x5e, idx: 0x0},
+ 248: {cur: 0x1b, idx: 0x349},
+ 249: {cur: 0x27, idx: 0x34c},
+ 250: {cur: 0x4b, idx: 0xa2},
+ 251: {cur: 0x58, idx: 0x3f},
+ 252: {cur: 0x81, idx: 0x34f},
+ 253: {cur: 0xcc, idx: 0x352},
+ 254: {cur: 0xdb, idx: 0x34f},
+ 255: {cur: 0x101, idx: 0x291},
+ 256: {cur: 0x58, idx: 0x0},
+ 257: {cur: 0xd0, idx: 0x4f},
+ 258: {cur: 0xf6, idx: 0xc7},
+ 259: {cur: 0x58, idx: 0x33},
+ 260: {cur: 0x61, idx: 0x268},
+ 261: {cur: 0xe4, idx: 0x37b},
+ 262: {cur: 0xe9, idx: 0x248},
+ 263: {cur: 0x104, idx: 0x380},
+ 264: {cur: 0x37, idx: 0x384},
+ 265: {cur: 0x61, idx: 0x3f},
+ 266: {cur: 0xd0, idx: 0xae},
+ 267: {cur: 0xe4, idx: 0x3f},
+ 268: {cur: 0xe9, idx: 0x3f},
+ 269: {cur: 0x61, idx: 0x3f},
+ 270: {cur: 0xd0, idx: 0xae},
+ 271: {cur: 0xe4, idx: 0x3f},
+ 272: {cur: 0xe9, idx: 0x3f},
+ 273: {cur: 0x104, idx: 0x392},
+ 274: {cur: 0xf6, idx: 0xc7},
+ 275: {cur: 0xf6, idx: 0xc7},
+ 276: {cur: 0x9, idx: 0x0},
+ 277: {cur: 0x11, idx: 0x0},
+ 278: {cur: 0x13, idx: 0x0},
+ 279: {cur: 0x18, idx: 0x0},
+ 280: {cur: 0x1a, idx: 0x0},
+ 281: {cur: 0x1b, idx: 0x0},
+ 282: {cur: 0x25, idx: 0x0},
+ 283: {cur: 0x26, idx: 0x0},
+ 284: {cur: 0x27, idx: 0x0},
+ 285: {cur: 0x2e, idx: 0x0},
+ 286: {cur: 0x32, idx: 0x0},
+ 287: {cur: 0x35, idx: 0x0},
+ 288: {cur: 0x37, idx: 0x0},
+ 289: {cur: 0x39, idx: 0x0},
+ 290: {cur: 0x3a, idx: 0x0},
+ 291: {cur: 0x41, idx: 0x0},
+ 292: {cur: 0x44, idx: 0x0},
+ 293: {cur: 0x45, idx: 0x0},
+ 294: {cur: 0x47, idx: 0x0},
+ 295: {cur: 0x4a, idx: 0x0},
+ 296: {cur: 0x4b, idx: 0x0},
+ 297: {cur: 0x4e, idx: 0x0},
+ 298: {cur: 0x52, idx: 0x0},
+ 299: {cur: 0x53, idx: 0x0},
+ 300: {cur: 0x58, idx: 0x0},
+ 301: {cur: 0x5c, idx: 0x0},
+ 302: {cur: 0x60, idx: 0x0},
+ 303: {cur: 0x61, idx: 0x0},
+ 304: {cur: 0x65, idx: 0x0},
+ 305: {cur: 0x68, idx: 0x0},
+ 306: {cur: 0x6a, idx: 0x0},
+ 307: {cur: 0x6e, idx: 0x0},
+ 308: {cur: 0x71, idx: 0x0},
+ 309: {cur: 0x72, idx: 0x0},
+ 310: {cur: 0x73, idx: 0x0},
+ 311: {cur: 0x75, idx: 0x0},
+ 312: {cur: 0x77, idx: 0x0},
+ 313: {cur: 0x78, idx: 0x0},
+ 314: {cur: 0x7c, idx: 0x0},
+ 315: {cur: 0x7d, idx: 0x0},
+ 316: {cur: 0x81, idx: 0x0},
+ 317: {cur: 0x83, idx: 0x0},
+ 318: {cur: 0x88, idx: 0x0},
+ 319: {cur: 0x89, idx: 0x0},
+ 320: {cur: 0x8a, idx: 0x0},
+ 321: {cur: 0x8d, idx: 0x0},
+ 322: {cur: 0x8f, idx: 0x0},
+ 323: {cur: 0x90, idx: 0x0},
+ 324: {cur: 0x91, idx: 0x0},
+ 325: {cur: 0x92, idx: 0x0},
+ 326: {cur: 0x93, idx: 0x0},
+ 327: {cur: 0x94, idx: 0x0},
+ 328: {cur: 0x96, idx: 0x0},
+ 329: {cur: 0x9b, idx: 0x0},
+ 330: {cur: 0xa3, idx: 0x0},
+ 331: {cur: 0xa8, idx: 0x0},
+ 332: {cur: 0xa9, idx: 0x0},
+ 333: {cur: 0xae, idx: 0x0},
+ 334: {cur: 0xb2, idx: 0x0},
+ 335: {cur: 0xb5, idx: 0x0},
+ 336: {cur: 0xb9, idx: 0x0},
+ 337: {cur: 0xba, idx: 0x0},
+ 338: {cur: 0xbc, idx: 0x0},
+ 339: {cur: 0xbe, idx: 0x0},
+ 340: {cur: 0xbf, idx: 0x0},
+ 341: {cur: 0xc0, idx: 0x0},
+ 342: {cur: 0xc7, idx: 0x0},
+ 343: {cur: 0xc8, idx: 0x0},
+ 344: {cur: 0xc9, idx: 0x0},
+ 345: {cur: 0xcc, idx: 0x0},
+ 346: {cur: 0xd0, idx: 0x0},
+ 347: {cur: 0xd3, idx: 0x0},
+ 348: {cur: 0xd4, idx: 0x0},
+ 349: {cur: 0xd6, idx: 0x0},
+ 350: {cur: 0xdb, idx: 0x0},
+ 351: {cur: 0xdc, idx: 0x0},
+ 352: {cur: 0xdd, idx: 0x0},
+ 353: {cur: 0xe2, idx: 0x0},
+ 354: {cur: 0xe4, idx: 0x0},
+ 355: {cur: 0xe5, idx: 0x0},
+ 356: {cur: 0xe9, idx: 0x0},
+ 357: {cur: 0xeb, idx: 0x0},
+ 358: {cur: 0xf1, idx: 0x0},
+ 359: {cur: 0xf4, idx: 0x0},
+ 360: {cur: 0xf5, idx: 0x0},
+ 361: {cur: 0xf6, idx: 0x0},
+ 362: {cur: 0xf8, idx: 0x0},
+ 363: {cur: 0x101, idx: 0x0},
+ 364: {cur: 0x104, idx: 0x0},
+ 365: {cur: 0x105, idx: 0x0},
+ 366: {cur: 0x110, idx: 0x0},
+ 367: {cur: 0x125, idx: 0x0},
+ 368: {cur: 0x127, idx: 0x0},
+ 369: {cur: 0xf6, idx: 0xc7},
+ 370: {cur: 0x58, idx: 0x3e5},
+ 371: {cur: 0x89, idx: 0x32a},
+ 372: {cur: 0x92, idx: 0x2b8},
+ 373: {cur: 0xbc, idx: 0x41a},
+ 374: {cur: 0xd0, idx: 0x4f},
+ 375: {cur: 0xd4, idx: 0x421},
+ 376: {cur: 0xf6, idx: 0xc7},
+ 377: {cur: 0x127, idx: 0x441},
+ 378: {cur: 0x37, idx: 0x258},
+ 379: {cur: 0x65, idx: 0x0},
+ 380: {cur: 0x89, idx: 0x6b},
+ 381: {cur: 0xbc, idx: 0x9b},
+ 382: {cur: 0x127, idx: 0xeb},
+ 383: {cur: 0xf6, idx: 0xc7},
+ 384: {cur: 0xd0, idx: 0xee},
+ 385: {cur: 0xf6, idx: 0xc7},
+ 386: {cur: 0x89, idx: 0x32a},
+ 387: {cur: 0xd2, idx: 0x46d},
+ 388: {cur: 0xf6, idx: 0xc7},
+ 389: {cur: 0xae, idx: 0x474},
+ 390: {cur: 0xf6, idx: 0xc7},
+ 391: {cur: 0xf6, idx: 0xc7},
+ 392: {cur: 0xd0, idx: 0x48e},
+ 393: {cur: 0xf6, idx: 0xc7},
+ 394: {cur: 0xf6, idx: 0xc7},
+ 395: {cur: 0xf6, idx: 0xc7},
+ 396: {cur: 0xf6, idx: 0xc7},
+ 397: {cur: 0xf6, idx: 0xc7},
+ 398: {cur: 0xf6, idx: 0xc7},
+ 399: {cur: 0x37, idx: 0x258},
+ 400: {cur: 0x58, idx: 0x3e5},
+ 401: {cur: 0xbe, idx: 0x49b},
+ 402: {cur: 0xf6, idx: 0xc7},
+ 403: {cur: 0x44, idx: 0x4a3},
+ 404: {cur: 0x85, idx: 0x4a3},
+ 405: {cur: 0xd0, idx: 0x4a7},
+ 406: {cur: 0xf6, idx: 0xc7},
+ 407: {cur: 0xf6, idx: 0xc7},
+ 408: {cur: 0xf6, idx: 0xc7},
+ 409: {cur: 0xd0, idx: 0x4b2},
+ 410: {cur: 0xf6, idx: 0xc7},
+ 411: {cur: 0xd0, idx: 0x4f},
+ 412: {cur: 0xf6, idx: 0xc7},
+ 413: {cur: 0x25, idx: 0x251},
+ 414: {cur: 0x32, idx: 0x255},
+ 415: {cur: 0x39, idx: 0x146},
+ 416: {cur: 0x3a, idx: 0x9b},
+ 417: {cur: 0x53, idx: 0x264},
+ 418: {cur: 0x58, idx: 0x4b9},
+ 419: {cur: 0x72, idx: 0x4b},
+ 420: {cur: 0x75, idx: 0x4bc},
+ 421: {cur: 0x83, idx: 0x275},
+ 422: {cur: 0xf5, idx: 0x21b},
+ 423: {cur: 0xf6, idx: 0xc7},
+ 424: {cur: 0xf6, idx: 0xc7},
+ 425: {cur: 0xf6, idx: 0xc7},
+ 426: {cur: 0x1b, idx: 0x0},
+ 427: {cur: 0x37, idx: 0x258},
+ 428: {cur: 0x7c, idx: 0x0},
+ 429: {cur: 0x7d, idx: 0x0},
+ 430: {cur: 0x88, idx: 0x0},
+ 431: {cur: 0x91, idx: 0x0},
+ 432: {cur: 0xa9, idx: 0x0},
+ 433: {cur: 0xc9, idx: 0x4c6},
+ 434: {cur: 0xcc, idx: 0x352},
+ 435: {cur: 0xd2, idx: 0x4c9},
+ 436: {cur: 0x105, idx: 0x0},
+ 437: {cur: 0xf6, idx: 0xc7},
+ 438: {cur: 0xf6, idx: 0xc7},
+ 439: {cur: 0xf6, idx: 0xc7},
+ 440: {cur: 0xdb, idx: 0x4d7},
+ 441: {cur: 0xf6, idx: 0xc7},
+ 442: {cur: 0xf6, idx: 0xc7},
+ 443: {cur: 0xf6, idx: 0xc7},
+ 444: {cur: 0x1a, idx: 0x24c},
+ 445: {cur: 0x32, idx: 0x255},
+ 446: {cur: 0xd0, idx: 0x4f},
+ 447: {cur: 0xf6, idx: 0xc7},
+ 448: {cur: 0xbf, idx: 0x4f1},
+ 449: {cur: 0xf6, idx: 0xc7},
+ 450: {cur: 0xf6, idx: 0xc7},
+ 451: {cur: 0xd0, idx: 0x500},
+ 452: {cur: 0xf6, idx: 0xc7},
+ 453: {cur: 0xd0, idx: 0x4f},
+ 454: {cur: 0xf6, idx: 0xc7},
+ 455: {cur: 0xf6, idx: 0xc7},
+ 456: {cur: 0x65, idx: 0x515},
+ 457: {cur: 0xd0, idx: 0x4f},
+ 458: {cur: 0xf6, idx: 0xc7},
+ 459: {cur: 0x37, idx: 0x258},
+ 460: {cur: 0x93, idx: 0x52c},
+ 461: {cur: 0xf6, idx: 0xc7},
+ 462: {cur: 0xf6, idx: 0xc7},
+ 463: {cur: 0xf6, idx: 0xc7},
+ 464: {cur: 0x65, idx: 0x515},
+ 465: {cur: 0xf6, idx: 0xc7},
+ 466: {cur: 0x37, idx: 0x552},
+ 467: {cur: 0x65, idx: 0x515},
+ 468: {cur: 0xf6, idx: 0xc7},
+ 469: {cur: 0x5c, idx: 0x0},
+ 470: {cur: 0xd0, idx: 0x4f},
+ 471: {cur: 0xf6, idx: 0xc7},
+ 472: {cur: 0xf6, idx: 0xc7},
+ 473: {cur: 0xf6, idx: 0xc7},
+ 474: {cur: 0xf6, idx: 0xc7},
+ 475: {cur: 0xf6, idx: 0xc7},
+ 476: {cur: 0xd0, idx: 0x4f},
+ 477: {cur: 0xf6, idx: 0xc7},
+ 478: {cur: 0xf6, idx: 0xc7},
+ 479: {cur: 0xf6, idx: 0xc7},
+ 480: {cur: 0xf6, idx: 0xc7},
+ 481: {cur: 0xf6, idx: 0xc7},
+ 482: {cur: 0xd0, idx: 0x4f},
+ 483: {cur: 0x37, idx: 0x59e},
+ 484: {cur: 0x52, idx: 0x34f},
+ 485: {cur: 0x75, idx: 0x4bc},
+ 486: {cur: 0x81, idx: 0x34f},
+ 487: {cur: 0xbe, idx: 0x34f},
+ 488: {cur: 0xc9, idx: 0x5a1},
+ 489: {cur: 0xdb, idx: 0x34f},
+ 490: {cur: 0xf6, idx: 0xc7},
+} // Size: 1988 bytes
+
+// Total table size 18885 bytes (18KiB); checksum: BE08FD0B
diff --git a/vendor/google.golang.org/api/iamcredentials/v1/iamcredentials-api.json b/vendor/google.golang.org/api/iamcredentials/v1/iamcredentials-api.json
index b3b17530c0..ae9e9cdf95 100644
--- a/vendor/google.golang.org/api/iamcredentials/v1/iamcredentials-api.json
+++ b/vendor/google.golang.org/api/iamcredentials/v1/iamcredentials-api.json
@@ -15,38 +15,6 @@
"description": "Creates short-lived credentials for impersonating IAM service accounts. Disabling this API also disables the IAM API (iam.googleapis.com). However, enabling this API doesn't enable the IAM API. ",
"discoveryVersion": "v1",
"documentationLink": "https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials",
- "endpoints": [
- {
- "description": "Regional Endpoint",
- "endpointUrl": "https://iamcredentials.asia-east1.rep.googleapis.com/",
- "location": "asia-east1"
- },
- {
- "description": "Regional Endpoint",
- "endpointUrl": "https://iamcredentials.europe-west1.rep.googleapis.com/",
- "location": "europe-west1"
- },
- {
- "description": "Regional Endpoint",
- "endpointUrl": "https://iamcredentials.us-central1.rep.googleapis.com/",
- "location": "us-central1"
- },
- {
- "description": "Regional Endpoint",
- "endpointUrl": "https://iamcredentials.us-east1.rep.googleapis.com/",
- "location": "us-east1"
- },
- {
- "description": "Regional Endpoint",
- "endpointUrl": "https://iamcredentials.us-east7.rep.googleapis.com/",
- "location": "us-east7"
- },
- {
- "description": "Regional Endpoint",
- "endpointUrl": "https://iamcredentials.us-west1.rep.googleapis.com/",
- "location": "us-west1"
- }
- ],
"fullyEncodeReservedExpansion": true,
"icons": {
"x16": "http://www.google.com/images/icons/product/search-16.gif",
@@ -340,7 +308,7 @@
}
}
},
- "revision": "20260604",
+ "revision": "20260630",
"rootUrl": "https://iamcredentials.googleapis.com/",
"schemas": {
"GenerateAccessTokenRequest": {
diff --git a/vendor/google.golang.org/api/internal/version.go b/vendor/google.golang.org/api/internal/version.go
index 146ea7c16f..c2c2c9beed 100644
--- a/vendor/google.golang.org/api/internal/version.go
+++ b/vendor/google.golang.org/api/internal/version.go
@@ -5,4 +5,4 @@
package internal
// Version is the current tagged release of the library.
-const Version = "0.287.1"
+const Version = "0.290.0"
diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
index 29d332e7b6..3334481274 100644
--- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
+++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
@@ -150,8 +150,18 @@ var (
// throttling limit if unforeseen issues arise, and it will be removed in a
// future release.
//
- // TODO: Remove this env var once v1.83.0 is release.
+ // TODO: Remove this env var once v1.83.0 is released.
ControlBufferThrottleLimit = uint64FromEnv("GRPC_GO_EXPERIMENTAL_CONTROL_BUFFER_THROTTLE_LIMIT", 100, 1, 10000)
+
+ // EnableReceiveBufferCompaction enables the compaction of data buffers
+ // to reduce the number of buffers in the receive buffer.
+ //
+ // This environment variable serves as an escape hatch to disable the
+ // feature if unforeseen issues arise, and it will be removed in a future
+ // release.
+ //
+ // TODO: Remove this env var once v1.85.0 is released.
+ EnableReceiveBufferCompaction = boolFromEnv("GRPC_GO_EXPERIMENTAL_ENABLE_RECEIVE_BUFFER_COMPACTION", true)
)
func boolFromEnv(envVar string, def bool) bool {
diff --git a/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go b/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go
index 2d83b2eced..00aeca419f 100644
--- a/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go
+++ b/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go
@@ -26,12 +26,26 @@ import (
"slices"
"sort"
"sync"
+
+ "google.golang.org/grpc/internal"
)
const (
goPageSize = 4 * 1024 // 4KiB. N.B. this must be a power of 2.
)
+var (
+ // BufferPoolingThreshold is the minimum size of a buffer that can be pooled.
+ // This is used to determine whether to pool buffers or allocate them directly.
+ BufferPoolingThreshold = 1 << 10
+)
+
+func init() {
+ internal.SetBufferPoolingThresholdForTesting = func(threshold int) {
+ BufferPoolingThreshold = threshold
+ }
+}
+
var uintSize = bits.UintSize // use a variable for mocking during tests.
// bufferPool is a copy of the public bufferPool interface used to avoid
diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go
index a8356c9adb..9cd8d28d33 100644
--- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go
+++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go
@@ -424,7 +424,7 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream
st: ht,
headerWireLength: 0, // won't have access to header wire length until golang/go#18997.
}
- s.Stream.buf.init()
+ s.Stream.buf.init(ht.bufferPool)
s.readRequester = s
s.trReader = transportReader{
reader: recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: &s.buf},
diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go
index c19b45080e..10d1977415 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go
@@ -500,7 +500,7 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr, handler s
headerChan: make(chan struct{}),
statsHandler: handler,
}
- s.Stream.buf.init()
+ s.Stream.buf.init(t.bufferPool)
s.Stream.wq.init(defaultWriteQuota, s.done)
s.readRequester = s
// The client side stream context should have exactly the same life cycle with the user provided context.
diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go
index be8ae9f9c5..63c6539a3d 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go
@@ -407,7 +407,7 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade
st: t,
headerWireLength: int(frame.Header().Length),
}
- s.Stream.buf.init()
+ s.Stream.buf.init(t.bufferPool)
var (
// if false, content-type was missing or invalid
isGRPC = false
diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go
index d2e49538f0..5fc901e5cf 100644
--- a/vendor/google.golang.org/grpc/internal/transport/transport.go
+++ b/vendor/google.golang.org/grpc/internal/transport/transport.go
@@ -30,11 +30,14 @@ import (
"sync"
"sync/atomic"
"time"
+ "unsafe"
"golang.org/x/net/http2"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/internal/channelz"
+ "google.golang.org/grpc/internal/envconfig"
+ imem "google.golang.org/grpc/internal/mem"
"google.golang.org/grpc/internal/transport/internal"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/mem"
@@ -45,7 +48,30 @@ import (
"google.golang.org/grpc/tap"
)
-const logLevel = 2
+const (
+ logLevel = 2
+ // recvMsgSize estimates the memory overhead of a recvMsg in the backlog.
+ // It accounts for the recvMsg struct itself and the slice header of the
+ // underlying buffer's data.
+ recvMsgSize = int(unsafe.Sizeof(recvMsg{}) + unsafe.Sizeof([]byte{}))
+
+ // utilizationFactor controls when we consider memory utilization acceptable.
+ // When backlogHeapSize / payloadSize <= utilizationFactor (meaning at least
+ // 50% of the heap memory is actual payload data), compaction is skipped.
+ utilizationFactor = 2
+)
+
+var (
+ // compactionThreshold is approx 57KB (on 64-bit systems). It allows
+ // accumulating up to 1024 1-byte payloads before triggering compaction.
+ //
+ // Because individual payloads <= 1024 bytes are allocated on the heap
+ // outside mem.BufferPool, waiting for at least 1024 bytes to accumulate
+ // ensures that compaction coalesces those small heap allocations into a
+ // single large buffer from mem.BufferPool, enabling buffer reuse while
+ // avoiding frequent copying for small bursts of frames.
+ compactionThreshold = imem.BufferPoolingThreshold * (recvMsgSize + 1)
+)
func init() {
internal.TimeNowFunc = func() int64 { return time.Now().UnixNano() }
@@ -71,23 +97,31 @@ type recvBuffer struct {
c chan recvMsg
mu sync.Mutex
backlog []recvMsg
- err error
+ // uncompactedSuffixLen tracks the number of consecutive data messages at
+ // the tail of backlog that have not been compacted.
+ uncompactedSuffixLen int
+ // uncompactedBytes tracks the total payload bytes across the trailing
+ // uncompactedSuffixLen messages.
+ uncompactedBytes int
+ err error
+ bufPool mem.BufferPool
}
// init allows a recvBuffer to be initialized in-place, which is useful
// for resetting a buffer or for avoiding a heap allocation when the buffer
// is embedded in another struct.
-func (b *recvBuffer) init() {
+func (b *recvBuffer) init(pool mem.BufferPool) {
b.c = make(chan recvMsg, 1)
+ b.bufPool = pool
}
func (b *recvBuffer) put(r recvMsg) {
b.mu.Lock()
+ defer b.mu.Unlock()
if b.err != nil {
// drop the buffer on the floor. Since b.err is not nil, any subsequent reads
// will always return an error, making this buffer inaccessible.
r.buffer.Free()
- b.mu.Unlock()
// An error had occurred earlier, don't accept more
// data or errors.
return
@@ -96,13 +130,70 @@ func (b *recvBuffer) put(r recvMsg) {
if len(b.backlog) == 0 {
select {
case b.c <- r:
- b.mu.Unlock()
return
default:
}
}
b.backlog = append(b.backlog, r)
- b.mu.Unlock()
+ b.compactBacklogLocked(r)
+}
+
+func (b *recvBuffer) compactBacklogLocked(r recvMsg) {
+ if !envconfig.EnableReceiveBufferCompaction {
+ return
+ }
+ if r.buffer == nil {
+ b.uncompactedBytes = 0
+ b.uncompactedSuffixLen = 0
+ return
+ }
+
+ b.uncompactedSuffixLen++
+ b.uncompactedBytes += r.buffer.Len()
+ backlogHeapSize := b.uncompactedSuffixLen*recvMsgSize + b.uncompactedBytes
+
+ // If the memory overhead is less than 50% of the heap usage (e.g., because
+ // a large DATA frame arrived), the average message size in the suffix is
+ // large enough that memory bloat is not a concern. Reset suffix tracking.
+ if backlogHeapSize <= utilizationFactor*b.uncompactedBytes {
+ b.uncompactedBytes = 0
+ b.uncompactedSuffixLen = 0
+ return
+ }
+ // Avoid compacting too frequently for short bursts of small frames.
+ // Wait until we have accumulated at least ~1024 small messages (~57 KB).
+ if backlogHeapSize <= compactionThreshold {
+ // Still can accumulate more payloads.
+ return
+ }
+
+ // Since the memory utilization is less than 50%, the average payload size
+ // of each recvMsg must be less than recvMsgSize (approx 56 bytes).
+ // In the worst case for bytes copied (where the average payload is just
+ // below recvMsgSize), compaction will occur once every:
+ // compactionThreshold / (recvMsgSize + avg_payload) = ~520 messages,
+ // copying ~29KB of data.
+
+ start := 0
+ newBuf := b.bufPool.Get(b.uncompactedBytes)
+ startIdx := len(b.backlog) - b.uncompactedSuffixLen
+
+ for i := startIdx; i < len(b.backlog); i++ {
+ m := b.backlog[i]
+ b.backlog[i] = recvMsg{}
+ start += copy((*newBuf)[start:], m.buffer.ReadOnlyData())
+ m.buffer.Free()
+ }
+ b.backlog[startIdx] = recvMsg{
+ buffer: mem.NewBuffer(newBuf, b.bufPool),
+ }
+ b.backlog = b.backlog[:startIdx+1]
+ // After compaction, the suffix is replaced with a single message containing
+ // the combined payload. The new utilization is close to 1.0 (overhead of
+ // one recvMsg relative to the large compacted payload), which is well
+ // below the utilization factor of 2.
+ b.uncompactedBytes = 0
+ b.uncompactedSuffixLen = 0
}
func (b *recvBuffer) load() {
@@ -110,6 +201,13 @@ func (b *recvBuffer) load() {
if len(b.backlog) > 0 {
select {
case b.c <- b.backlog[0]:
+ // backlog[0] is only part of the tracked uncompacted suffix if the
+ // entire backlog currently consists of the suffix. If an earlier
+ // compaction or reset occurred, backlog[0] is already compacted.
+ if envconfig.EnableReceiveBufferCompaction && b.uncompactedSuffixLen == len(b.backlog) {
+ b.uncompactedSuffixLen--
+ b.uncompactedBytes -= b.backlog[0].buffer.Len()
+ }
b.backlog[0] = recvMsg{}
b.backlog = b.backlog[1:]
default:
diff --git a/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go b/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go
index eb42a7fb1f..1af2c2065b 100644
--- a/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go
+++ b/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go
@@ -32,6 +32,7 @@ import (
"google.golang.org/protobuf/types/known/anypb"
v3rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3"
+ v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
rpb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/rbac/v3"
)
@@ -68,36 +69,25 @@ func parseConfig(rbacCfg *rpb.RBAC) (httpfilter.FilterConfig, error) {
}
// "It is also a validation failure if Permission or Principal has a
- // header matcher for a grpc- prefixed header name or :scheme." - A41
- for _, principal := range policy.Principals {
- name := principal.GetHeader().GetName()
- if name == ":scheme" || strings.HasPrefix(name, "grpc-") {
- return nil, fmt.Errorf("rbac: principal header matcher for %v is :scheme or starts with grpc", name)
+ // header matcher for a grpc- prefixed header name or :scheme." - A41.
+ //
+ // "Envoy aliases :authority and Host in its header map implementation,
+ // so they should be treated equivalent for the RBAC matchers; there must
+ // be no behavior change depending on which of the two header names is
+ // used in the RBAC policy." - A41. Any header matcher with value "host"
+ // is rewritten to ":authority", as that is what grpc-go shifts both
+ // headers to in the transport layer.
+ //
+ // Both rules apply to header matchers nested inside and/or/not rules, so
+ // the whole permission and principal trees are walked.
+ for _, principal := range policy.GetPrincipals() {
+ if err := normalizePrincipalHeaders(principal); err != nil {
+ return nil, err
}
}
- for _, permission := range policy.Permissions {
- name := permission.GetHeader().GetName()
- if name == ":scheme" || strings.HasPrefix(name, "grpc-") {
- return nil, fmt.Errorf("rbac: permission header matcher for %v is :scheme or starts with grpc", name)
- }
- }
- }
-
- // "Envoy aliases :authority and Host in its header map implementation, so
- // they should be treated equivalent for the RBAC matchers; there must be no
- // behavior change depending on which of the two header names is used in the
- // RBAC policy." - A41. Loop through config's principals and policies, change
- // any header matcher with value "host" to :authority", as that is what
- // grpc-go shifts both headers to in transport layer.
- for _, policy := range rbacCfg.GetRules().GetPolicies() {
- for _, principal := range policy.Principals {
- if principal.GetHeader().GetName() == "host" {
- principal.GetHeader().Name = ":authority"
- }
- }
- for _, permission := range policy.Permissions {
- if permission.GetHeader().GetName() == "host" {
- permission.GetHeader().Name = ":authority"
+ for _, permission := range policy.GetPermissions() {
+ if err := normalizePermissionHeaders(permission); err != nil {
+ return nil, err
}
}
}
@@ -126,6 +116,82 @@ func parseConfig(rbacCfg *rpb.RBAC) (httpfilter.FilterConfig, error) {
return config{chainEngine: ce}, nil
}
+// normalizePermissionHeaders applies the A41 header-name rules to every header
+// matcher reachable from permission, including those nested inside and/or/not
+// rules.
+func normalizePermissionHeaders(permission *v3rbacpb.Permission) error {
+ switch p := permission.GetRule().(type) {
+ case *v3rbacpb.Permission_Header:
+ return normalizeHeaderMatcher(p.Header)
+ case *v3rbacpb.Permission_AndRules:
+ for _, rule := range p.AndRules.GetRules() {
+ if err := normalizePermissionHeaders(rule); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Permission_OrRules:
+ for _, rule := range p.OrRules.GetRules() {
+ if err := normalizePermissionHeaders(rule); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Permission_NotRule:
+ return normalizePermissionHeaders(p.NotRule)
+ }
+ return nil
+}
+
+// normalizePrincipalHeaders applies the A41 header-name rules to every header
+// matcher reachable from principal, including those nested inside and/or/not
+// ids.
+func normalizePrincipalHeaders(principal *v3rbacpb.Principal) error {
+ switch p := principal.GetIdentifier().(type) {
+ case *v3rbacpb.Principal_Header:
+ return normalizeHeaderMatcher(p.Header)
+ case *v3rbacpb.Principal_AndIds:
+ for _, id := range p.AndIds.GetIds() {
+ if err := normalizePrincipalHeaders(id); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Principal_OrIds:
+ for _, id := range p.OrIds.GetIds() {
+ if err := normalizePrincipalHeaders(id); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Principal_NotId:
+ return normalizePrincipalHeaders(p.NotId)
+ }
+ return nil
+}
+
+// normalizeHeaderMatcher lowercases the name of a header matcher, rejects the
+// names that A41 forbids (:scheme or a grpc- prefixed name) and rewrites a
+// "host" matcher to ":authority".
+func normalizeHeaderMatcher(header *v3routepb.HeaderMatcher) error {
+ // The keys of the metadata the matchers run against are always lowercase,
+ // so a name that contains an uppercase character matches no header at all
+ // and the rule using it never fires. Lowercase the name, as Envoy and
+ // grpc-java do, both to make it match and to keep the checks below from
+ // being evaded by the case of the name.
+ name := header.GetName()
+ lowerName := strings.ToLower(name)
+ if lowerName != name {
+ header.Name = lowerName
+ }
+ if lowerName == ":scheme" {
+ return fmt.Errorf("rbac: header matcher for %q is %q", name, ":scheme")
+ }
+ if strings.HasPrefix(lowerName, "grpc-") {
+ return fmt.Errorf("rbac: header matcher for %q starts with %q", name, "grpc-")
+ }
+ if lowerName == "host" {
+ header.Name = ":authority"
+ }
+ return nil
+}
+
func (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {
if cfg == nil {
return nil, fmt.Errorf("rbac: nil configuration message provided")
diff --git a/vendor/google.golang.org/grpc/mem/buffer_pool.go b/vendor/google.golang.org/grpc/mem/buffer_pool.go
index 3b02b90916..aa121379fd 100644
--- a/vendor/google.golang.org/grpc/mem/buffer_pool.go
+++ b/vendor/google.golang.org/grpc/mem/buffer_pool.go
@@ -59,10 +59,6 @@ func init() {
internal.SetDefaultBufferPool = func(pool BufferPool) {
defaultBufferPool = pool
}
-
- internal.SetBufferPoolingThresholdForTesting = func(threshold int) {
- bufferPoolingThreshold = threshold
- }
}
// DefaultBufferPool returns the current default buffer pool. It is a BufferPool
diff --git a/vendor/google.golang.org/grpc/mem/buffers.go b/vendor/google.golang.org/grpc/mem/buffers.go
index 2b410b16eb..9b355d4465 100644
--- a/vendor/google.golang.org/grpc/mem/buffers.go
+++ b/vendor/google.golang.org/grpc/mem/buffers.go
@@ -29,6 +29,8 @@ import (
"fmt"
"sync"
"sync/atomic"
+
+ "google.golang.org/grpc/internal/mem"
)
// A Buffer represents a reference counted piece of data (in bytes) that can be
@@ -63,8 +65,6 @@ type Buffer interface {
}
var (
- bufferPoolingThreshold = 1 << 10
-
bufferObjectPool = sync.Pool{New: func() any { return new(buffer) }}
)
@@ -72,7 +72,7 @@ var (
// equal to the threshold for buffer pooling. This is used to determine whether
// to pool buffers or allocate them directly.
func IsBelowBufferPoolingThreshold(size int) bool {
- return size <= bufferPoolingThreshold
+ return size <= mem.BufferPoolingThreshold
}
type buffer struct {
diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go
index 4083c03908..64ec3b3cfd 100644
--- a/vendor/google.golang.org/grpc/version.go
+++ b/vendor/google.golang.org/grpc/version.go
@@ -19,4 +19,4 @@
package grpc
// Version is the current grpc version.
-const Version = "1.83.0"
+const Version = "1.83.1"
diff --git a/vendor/k8s.io/client-go/tools/cache/fake_custom_store.go b/vendor/k8s.io/client-go/tools/cache/fake_custom_store.go
index 462d22660c..e6456f7c9d 100644
--- a/vendor/k8s.io/client-go/tools/cache/fake_custom_store.go
+++ b/vendor/k8s.io/client-go/tools/cache/fake_custom_store.go
@@ -18,17 +18,21 @@ package cache
// FakeCustomStore lets you define custom functions for store operations.
type FakeCustomStore struct {
- AddFunc func(obj interface{}) error
- UpdateFunc func(obj interface{}) error
- DeleteFunc func(obj interface{}) error
- ListFunc func() []interface{}
- ListKeysFunc func() []string
- GetFunc func(obj interface{}) (item interface{}, exists bool, err error)
- GetByKeyFunc func(key string) (item interface{}, exists bool, err error)
- ReplaceFunc func(list []interface{}, resourceVersion string) error
- ResyncFunc func() error
+ AddFunc func(obj interface{}) error
+ UpdateFunc func(obj interface{}) error
+ DeleteFunc func(obj interface{}) error
+ ListFunc func() []interface{}
+ ListKeysFunc func() []string
+ GetFunc func(obj interface{}) (item interface{}, exists bool, err error)
+ GetByKeyFunc func(key string) (item interface{}, exists bool, err error)
+ ReplaceFunc func(list []interface{}, resourceVersion string) error
+ ResyncFunc func() error
+ BookmarkFunc func(rv string)
+ LastStoreSyncResourceVersionFunc func() string
}
+var _ Store = &FakeCustomStore{}
+
// Add calls the custom Add function if defined
func (f *FakeCustomStore) Add(obj interface{}) error {
if f.AddFunc != nil {
@@ -100,3 +104,18 @@ func (f *FakeCustomStore) Resync() error {
}
return nil
}
+
+// Bookmark calls the custom Bookmark function if defined
+func (f *FakeCustomStore) Bookmark(rv string) {
+ if f.BookmarkFunc != nil {
+ f.BookmarkFunc(rv)
+ }
+}
+
+// LastStoreSyncResourceVersion calls the custom LastStoreSyncResourceVersion function if defined
+func (f *FakeCustomStore) LastStoreSyncResourceVersion() string {
+ if f.LastStoreSyncResourceVersionFunc != nil {
+ return f.LastStoreSyncResourceVersionFunc()
+ }
+ return ""
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 15660db91b..41f32550ff 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -47,7 +47,7 @@ cloud.google.com/go/compute/metadata
cloud.google.com/go/firestore/apiv1
cloud.google.com/go/firestore/apiv1/firestorepb
cloud.google.com/go/firestore/internal
-# cloud.google.com/go/iam v1.11.0
+# cloud.google.com/go/iam v1.13.0
## explicit; go 1.25.0
cloud.google.com/go/iam
cloud.google.com/go/iam/apiv1/iampb
@@ -127,10 +127,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime
github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming
github.com/Azure/azure-sdk-for-go/sdk/azcore/to
github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing
-# github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1
-## explicit; go 1.23.0
+# github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0
+## explicit; go 1.25.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity
github.com/Azure/azure-sdk-for-go/sdk/azidentity/internal
+github.com/Azure/azure-sdk-for-go/sdk/azidentity/internal/customtokenproxy
# github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry v0.2.3
## explicit; go 1.23.0
github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry
@@ -178,7 +179,7 @@ github.com/Azure/go-autorest/logger
# github.com/Azure/go-autorest/tracing v0.6.0
## explicit; go 1.12
github.com/Azure/go-autorest/tracing
-# github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0
+# github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2
## explicit; go 1.18
github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache
github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential
@@ -244,6 +245,30 @@ github.com/Microsoft/go-winio/pkg/guid
## explicit; go 1.23.0
github.com/OpenPeeDeeP/depguard/v2
github.com/OpenPeeDeeP/depguard/v2/internal/utils
+# github.com/ProtonMail/go-crypto v1.4.1
+## explicit; go 1.23.0
+github.com/ProtonMail/go-crypto/bitcurves
+github.com/ProtonMail/go-crypto/brainpool
+github.com/ProtonMail/go-crypto/eax
+github.com/ProtonMail/go-crypto/internal/byteutil
+github.com/ProtonMail/go-crypto/ocb
+github.com/ProtonMail/go-crypto/openpgp
+github.com/ProtonMail/go-crypto/openpgp/aes/keywrap
+github.com/ProtonMail/go-crypto/openpgp/armor
+github.com/ProtonMail/go-crypto/openpgp/ecdh
+github.com/ProtonMail/go-crypto/openpgp/ecdsa
+github.com/ProtonMail/go-crypto/openpgp/ed25519
+github.com/ProtonMail/go-crypto/openpgp/ed448
+github.com/ProtonMail/go-crypto/openpgp/eddsa
+github.com/ProtonMail/go-crypto/openpgp/elgamal
+github.com/ProtonMail/go-crypto/openpgp/errors
+github.com/ProtonMail/go-crypto/openpgp/internal/algorithm
+github.com/ProtonMail/go-crypto/openpgp/internal/ecc
+github.com/ProtonMail/go-crypto/openpgp/internal/encoding
+github.com/ProtonMail/go-crypto/openpgp/packet
+github.com/ProtonMail/go-crypto/openpgp/s2k
+github.com/ProtonMail/go-crypto/openpgp/x25519
+github.com/ProtonMail/go-crypto/openpgp/x448
# github.com/ThalesIgnite/crypto11 v1.2.5
## explicit; go 1.13
github.com/ThalesIgnite/crypto11
@@ -406,7 +431,7 @@ github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery
# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.31
## explicit; go 1.24
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url
-# github.com/aws/aws-sdk-go-v2/service/kms v1.54.0
+# github.com/aws/aws-sdk-go-v2/service/kms v1.55.0
## explicit; go 1.24
github.com/aws/aws-sdk-go-v2/service/kms
github.com/aws/aws-sdk-go-v2/service/kms/internal/endpoints
@@ -474,9 +499,6 @@ github.com/beorn7/perks/quantile
# github.com/bkielbasa/cyclop v1.2.3
## explicit; go 1.22.0
github.com/bkielbasa/cyclop/pkg/analyzer
-# github.com/blang/semver v3.5.1+incompatible
-## explicit
-github.com/blang/semver
# github.com/blang/semver/v4 v4.0.0
## explicit; go 1.14
github.com/blang/semver/v4
@@ -587,6 +609,20 @@ github.com/cloudevents/sdk-go/v2/event/datacodec/xml
github.com/cloudevents/sdk-go/v2/protocol
github.com/cloudevents/sdk-go/v2/protocol/http
github.com/cloudevents/sdk-go/v2/types
+# github.com/cloudflare/circl v1.6.3
+## explicit; go 1.22.0
+github.com/cloudflare/circl/dh/x25519
+github.com/cloudflare/circl/dh/x448
+github.com/cloudflare/circl/ecc/goldilocks
+github.com/cloudflare/circl/internal/conv
+github.com/cloudflare/circl/internal/sha3
+github.com/cloudflare/circl/math
+github.com/cloudflare/circl/math/fp25519
+github.com/cloudflare/circl/math/fp448
+github.com/cloudflare/circl/math/mlsbset
+github.com/cloudflare/circl/sign
+github.com/cloudflare/circl/sign/ed25519
+github.com/cloudflare/circl/sign/ed448
# github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2
## explicit; go 1.24.6
github.com/cncf/xds/go/udpa/annotations
@@ -754,7 +790,7 @@ github.com/gaganhr94/docker-credential-acr/pkg/token
# github.com/ghostiam/protogetter v0.3.9
## explicit; go 1.22.0
github.com/ghostiam/protogetter
-# github.com/go-chi/chi/v5 v5.3.0
+# github.com/go-chi/chi/v5 v5.3.1
## explicit; go 1.23
github.com/go-chi/chi/v5
github.com/go-chi/chi/v5/middleware
@@ -782,7 +818,7 @@ github.com/go-logr/stdr
# github.com/go-logr/zapr v1.3.0
## explicit; go 1.18
github.com/go-logr/zapr
-# github.com/go-openapi/analysis v0.25.2
+# github.com/go-openapi/analysis v0.26.0
## explicit; go 1.25.0
github.com/go-openapi/analysis
github.com/go-openapi/analysis/internal/debug
@@ -794,17 +830,18 @@ github.com/go-openapi/analysis/internal/flatten/sortref
# github.com/go-openapi/errors v0.22.8
## explicit; go 1.25.0
github.com/go-openapi/errors
-# github.com/go-openapi/jsonpointer v0.23.1
+# github.com/go-openapi/jsonpointer v1.0.0
## explicit; go 1.25.0
github.com/go-openapi/jsonpointer
-# github.com/go-openapi/jsonreference v0.21.6
+github.com/go-openapi/jsonpointer/jsonname
+# github.com/go-openapi/jsonreference v1.0.0
## explicit; go 1.25.0
github.com/go-openapi/jsonreference
github.com/go-openapi/jsonreference/internal
-# github.com/go-openapi/loads v0.24.0
+# github.com/go-openapi/loads v0.25.1
## explicit; go 1.25.0
github.com/go-openapi/loads
-# github.com/go-openapi/runtime v0.32.4
+# github.com/go-openapi/runtime v0.32.5
## explicit; go 1.25.0
github.com/go-openapi/runtime
github.com/go-openapi/runtime/client
@@ -821,53 +858,57 @@ github.com/go-openapi/runtime/server-middleware/docui
github.com/go-openapi/runtime/server-middleware/mediatype
github.com/go-openapi/runtime/server-middleware/negotiate
github.com/go-openapi/runtime/server-middleware/negotiate/header
-# github.com/go-openapi/spec v0.22.6
+# github.com/go-openapi/spec v0.22.9
## explicit; go 1.25.0
github.com/go-openapi/spec
-# github.com/go-openapi/strfmt v0.26.4
+# github.com/go-openapi/strfmt v0.27.0
## explicit; go 1.25.0
github.com/go-openapi/strfmt
github.com/go-openapi/strfmt/internal/bsonlite
+github.com/go-openapi/strfmt/internal/countries
# github.com/go-openapi/swag v0.26.1
## explicit; go 1.25.0
github.com/go-openapi/swag
# github.com/go-openapi/swag/cmdutils v0.26.1
## explicit; go 1.25.0
github.com/go-openapi/swag/cmdutils
-# github.com/go-openapi/swag/conv v0.26.1
+# github.com/go-openapi/swag/conv v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/conv
-# github.com/go-openapi/swag/fileutils v0.26.1
+# github.com/go-openapi/swag/fileutils v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/fileutils
# github.com/go-openapi/swag/jsonname v0.26.1
## explicit; go 1.25.0
github.com/go-openapi/swag/jsonname
-# github.com/go-openapi/swag/jsonutils v0.26.1
+# github.com/go-openapi/swag/jsonutils v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/jsonutils
github.com/go-openapi/swag/jsonutils/adapters
github.com/go-openapi/swag/jsonutils/adapters/ifaces
github.com/go-openapi/swag/jsonutils/adapters/stdlib/json
-# github.com/go-openapi/swag/loading v0.26.1
+# github.com/go-openapi/swag/loading v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/loading
-# github.com/go-openapi/swag/mangling v0.26.1
+# github.com/go-openapi/swag/mangling v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/mangling
# github.com/go-openapi/swag/netutils v0.26.1
## explicit; go 1.25.0
github.com/go-openapi/swag/netutils
-# github.com/go-openapi/swag/stringutils v0.26.1
+# github.com/go-openapi/swag/pools v0.28.0
+## explicit; go 1.25.0
+github.com/go-openapi/swag/pools
+# github.com/go-openapi/swag/stringutils v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/stringutils
-# github.com/go-openapi/swag/typeutils v0.26.1
+# github.com/go-openapi/swag/typeutils v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/typeutils
-# github.com/go-openapi/swag/yamlutils v0.26.1
+# github.com/go-openapi/swag/yamlutils v0.28.0
## explicit; go 1.25.0
github.com/go-openapi/swag/yamlutils
-# github.com/go-openapi/validate v0.26.0
+# github.com/go-openapi/validate v0.26.3
## explicit; go 1.25.0
github.com/go-openapi/validate
# github.com/go-quicktest/qt v1.101.1-0.20240301121107-c6c8733fa1e6
@@ -1254,7 +1295,7 @@ github.com/google/uuid
# github.com/google/wire v0.7.0
## explicit; go 1.19
github.com/google/wire
-# github.com/googleapis/enterprise-certificate-proxy v0.3.17
+# github.com/googleapis/enterprise-certificate-proxy v0.3.18
## explicit; go 1.25.0
github.com/googleapis/enterprise-certificate-proxy/client
github.com/googleapis/enterprise-certificate-proxy/client/util
@@ -1548,7 +1589,7 @@ github.com/mgechev/revive/internal/ifelse
github.com/mgechev/revive/internal/typeparams
github.com/mgechev/revive/lint
github.com/mgechev/revive/rule
-# github.com/miekg/pkcs11 v1.1.1
+# github.com/miekg/pkcs11 v1.1.2
## explicit; go 1.12
github.com/miekg/pkcs11
# github.com/mitchellh/go-homedir v1.1.0
@@ -1687,8 +1728,8 @@ github.com/pmezard/go-difflib/difflib
# github.com/polyfloyd/go-errorlint v1.7.1
## explicit; go 1.22.0
github.com/polyfloyd/go-errorlint/errorlint
-# github.com/prometheus/client_golang v1.23.2
-## explicit; go 1.23.0
+# github.com/prometheus/client_golang v1.24.1
+## explicit; go 1.25.0
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header
github.com/prometheus/client_golang/prometheus
@@ -1707,7 +1748,7 @@ github.com/prometheus/common/model
# github.com/prometheus/otlptranslator v1.0.0
## explicit; go 1.23.0
github.com/prometheus/otlptranslator
-# github.com/prometheus/procfs v0.21.0
+# github.com/prometheus/procfs v0.21.1
## explicit; go 1.25.0
github.com/prometheus/procfs
github.com/prometheus/procfs/internal/fs
@@ -1784,11 +1825,12 @@ github.com/sashamelentyev/interfacebloat/pkg/analyzer
## explicit; go 1.20
github.com/sashamelentyev/usestdlibvars/pkg/analyzer
github.com/sashamelentyev/usestdlibvars/pkg/analyzer/internal/mapping
-# github.com/sassoftware/relic v7.2.1+incompatible
-## explicit
-github.com/sassoftware/relic/lib/pkcs7
-github.com/sassoftware/relic/lib/x509tools
-# github.com/secure-systems-lab/go-securesystemslib v0.11.0
+# github.com/sassoftware/relic/v8 v8.2.0
+## explicit; go 1.22.0
+github.com/sassoftware/relic/v8/lib/pkcs7
+github.com/sassoftware/relic/v8/lib/x509tools
+github.com/sassoftware/relic/v8/signers/sigerrors
+# github.com/secure-systems-lab/go-securesystemslib v0.11.1
## explicit; go 1.25.0
github.com/secure-systems-lab/go-securesystemslib/cjson
github.com/secure-systems-lab/go-securesystemslib/dsse
@@ -1859,8 +1901,8 @@ github.com/sigstore/protobuf-specs/gen/pb-go/common/v1
github.com/sigstore/protobuf-specs/gen/pb-go/dsse
github.com/sigstore/protobuf-specs/gen/pb-go/rekor/v1
github.com/sigstore/protobuf-specs/gen/pb-go/trustroot/v1
-# github.com/sigstore/rekor v1.5.3
-## explicit; go 1.25.0
+# github.com/sigstore/rekor v1.5.4
+## explicit; go 1.25.11
github.com/sigstore/rekor/pkg/client
github.com/sigstore/rekor/pkg/generated/client
github.com/sigstore/rekor/pkg/generated/client/entries
@@ -2472,8 +2514,8 @@ go.opentelemetry.io/proto/otlp/common/v1
go.opentelemetry.io/proto/otlp/metrics/v1
go.opentelemetry.io/proto/otlp/resource/v1
go.opentelemetry.io/proto/otlp/trace/v1
-# go.step.sm/crypto v0.81.1
-## explicit; go 1.25.1
+# go.step.sm/crypto v0.87.0
+## explicit; go 1.25.8
go.step.sm/crypto/fingerprint
go.step.sm/crypto/internal/bcrypt_pbkdf
go.step.sm/crypto/internal/emoji
@@ -2538,6 +2580,7 @@ gocloud.dev/docstore/mongodocstore
gocloud.dev/pubsub/kafkapubsub
# golang.org/x/crypto v0.55.0
## explicit; go 1.25.0
+golang.org/x/crypto/argon2
golang.org/x/crypto/blake2b
golang.org/x/crypto/blowfish
golang.org/x/crypto/cast5
@@ -2565,11 +2608,11 @@ golang.org/x/crypto/pkcs12
golang.org/x/crypto/pkcs12/internal/rc2
golang.org/x/crypto/salsa20/salsa
golang.org/x/crypto/scrypt
+golang.org/x/crypto/sha3
golang.org/x/crypto/ssh
golang.org/x/crypto/ssh/agent
golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
golang.org/x/crypto/ssh/knownhosts
-golang.org/x/crypto/ssh/terminal
# golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
## explicit; go 1.25.0
golang.org/x/exp/maps
@@ -2629,6 +2672,7 @@ golang.org/x/sys/windows/registry
golang.org/x/term
# golang.org/x/text v0.41.0
## explicit; go 1.25.0
+golang.org/x/text/currency
golang.org/x/text/encoding
golang.org/x/text/encoding/internal
golang.org/x/text/encoding/internal/identifier
@@ -2751,7 +2795,7 @@ golang.org/x/xerrors/internal
# gomodules.xyz/jsonpatch/v2 v2.5.0
## explicit; go 1.20
gomodules.xyz/jsonpatch/v2
-# google.golang.org/api v0.287.1
+# google.golang.org/api v0.290.0
## explicit; go 1.25.0
google.golang.org/api/googleapi
google.golang.org/api/googleapi/transport
@@ -2771,8 +2815,8 @@ google.golang.org/api/storage/v1
google.golang.org/api/transport
google.golang.org/api/transport/grpc
google.golang.org/api/transport/http
-# google.golang.org/genproto v0.0.0-20260519071638-aa98bba5eb94
-## explicit; go 1.25.0
+# google.golang.org/genproto v0.0.0-20260622175928-b703f567277d
+## explicit; go 1.25.8
google.golang.org/genproto/googleapis/cloud/location
google.golang.org/genproto/googleapis/type/calendarperiod
google.golang.org/genproto/googleapis/type/date
@@ -2795,7 +2839,7 @@ google.golang.org/genproto/googleapis/api/monitoredres
google.golang.org/genproto/googleapis/rpc/code
google.golang.org/genproto/googleapis/rpc/errdetails
google.golang.org/genproto/googleapis/rpc/status
-# google.golang.org/grpc v1.83.0
+# google.golang.org/grpc v1.83.1
## explicit; go 1.25.0
google.golang.org/grpc
google.golang.org/grpc/attributes
@@ -3251,7 +3295,7 @@ honnef.co/go/tools/stylecheck/st1021
honnef.co/go/tools/stylecheck/st1022
honnef.co/go/tools/stylecheck/st1023
honnef.co/go/tools/unused
-# k8s.io/api v0.36.3
+# k8s.io/api v0.36.4
## explicit; go 1.26.0
k8s.io/api/admission/v1
k8s.io/api/admissionregistration/v1
@@ -3321,7 +3365,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1
-# k8s.io/apimachinery v0.36.3
+# k8s.io/apimachinery v0.36.4
## explicit; go 1.26.0
k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors
@@ -3382,7 +3426,7 @@ k8s.io/apimachinery/pkg/version
k8s.io/apimachinery/pkg/watch
k8s.io/apimachinery/third_party/forked/golang/json
k8s.io/apimachinery/third_party/forked/golang/reflect
-# k8s.io/client-go v0.36.3
+# k8s.io/client-go v0.36.4
## explicit; go 1.26.0
k8s.io/client-go/applyconfigurations
k8s.io/client-go/applyconfigurations/admissionregistration/v1
@@ -3710,7 +3754,7 @@ k8s.io/client-go/util/keyutil
k8s.io/client-go/util/retry
k8s.io/client-go/util/watchlist
k8s.io/client-go/util/workqueue
-# k8s.io/code-generator v0.36.3
+# k8s.io/code-generator v0.36.4
## explicit; go 1.26.0
k8s.io/code-generator/cmd/deepcopy-gen
k8s.io/code-generator/cmd/deepcopy-gen/args