summaryrefslogtreecommitdiffstats
path: root/contrib/go/_std_1.25/src/crypto/hkdf
diff options
context:
space:
mode:
authorYDBot <[email protected]>2026-06-10 06:27:27 +0000
committerYDBot <[email protected]>2026-06-10 06:27:27 +0000
commiteb8c7d3ee0c13034ecf5d8d35c24cefc40f0bb3f (patch)
treea1eba7fec49a258bb24bfa77808233496ac0047f /contrib/go/_std_1.25/src/crypto/hkdf
parentc4011885693f041c96b035f368aae8a1baac8885 (diff)
parent72cfbf8958fa6fa5227e9ad6466abfc635fdeb15 (diff)
Merge pull request #43056 from ydb-platform/merge-rightlib-260610-0127HEADmain
Diffstat (limited to 'contrib/go/_std_1.25/src/crypto/hkdf')
-rw-r--r--contrib/go/_std_1.25/src/crypto/hkdf/hkdf.go84
-rw-r--r--contrib/go/_std_1.25/src/crypto/hkdf/ya.make12
2 files changed, 0 insertions, 96 deletions
diff --git a/contrib/go/_std_1.25/src/crypto/hkdf/hkdf.go b/contrib/go/_std_1.25/src/crypto/hkdf/hkdf.go
deleted file mode 100644
index 6b02522866d..00000000000
--- a/contrib/go/_std_1.25/src/crypto/hkdf/hkdf.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2024 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 hkdf implements the HMAC-based Extract-and-Expand Key Derivation
-// Function (HKDF) as defined in RFC 5869.
-//
-// HKDF is a cryptographic key derivation function (KDF) with the goal of
-// expanding limited input keying material into one or more cryptographically
-// strong secret keys.
-package hkdf
-
-import (
- "crypto/internal/fips140/hkdf"
- "crypto/internal/fips140hash"
- "crypto/internal/fips140only"
- "errors"
- "hash"
-)
-
-// Extract generates a pseudorandom key for use with [Expand] from an input
-// secret and an optional independent salt.
-//
-// Only use this function if you need to reuse the extracted key with multiple
-// Expand invocations and different context values. Most common scenarios,
-// including the generation of multiple keys, should use [Key] instead.
-func Extract[H hash.Hash](h func() H, secret, salt []byte) ([]byte, error) {
- fh := fips140hash.UnwrapNew(h)
- if err := checkFIPS140Only(fh, secret); err != nil {
- return nil, err
- }
- return hkdf.Extract(fh, secret, salt), nil
-}
-
-// Expand derives a key from the given hash, key, and optional context info,
-// returning a []byte of length keyLength that can be used as cryptographic key.
-// The extraction step is skipped.
-//
-// The key should have been generated by [Extract], or be a uniformly
-// random or pseudorandom cryptographically strong key. See RFC 5869, Section
-// 3.3. Most common scenarios will want to use [Key] instead.
-func Expand[H hash.Hash](h func() H, pseudorandomKey []byte, info string, keyLength int) ([]byte, error) {
- fh := fips140hash.UnwrapNew(h)
- if err := checkFIPS140Only(fh, pseudorandomKey); err != nil {
- return nil, err
- }
-
- limit := fh().Size() * 255
- if keyLength > limit {
- return nil, errors.New("hkdf: requested key length too large")
- }
-
- return hkdf.Expand(fh, pseudorandomKey, info, keyLength), nil
-}
-
-// Key derives a key from the given hash, secret, salt and context info,
-// returning a []byte of length keyLength that can be used as cryptographic key.
-// Salt and info can be nil.
-func Key[Hash hash.Hash](h func() Hash, secret, salt []byte, info string, keyLength int) ([]byte, error) {
- fh := fips140hash.UnwrapNew(h)
- if err := checkFIPS140Only(fh, secret); err != nil {
- return nil, err
- }
-
- limit := fh().Size() * 255
- if keyLength > limit {
- return nil, errors.New("hkdf: requested key length too large")
- }
-
- return hkdf.Key(fh, secret, salt, info, keyLength), nil
-}
-
-func checkFIPS140Only[Hash hash.Hash](h func() Hash, key []byte) error {
- if !fips140only.Enabled {
- return nil
- }
- if len(key) < 112/8 {
- return errors.New("crypto/hkdf: use of keys shorter than 112 bits is not allowed in FIPS 140-only mode")
- }
- if !fips140only.ApprovedHash(h()) {
- return errors.New("crypto/hkdf: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode")
- }
- return nil
-}
diff --git a/contrib/go/_std_1.25/src/crypto/hkdf/ya.make b/contrib/go/_std_1.25/src/crypto/hkdf/ya.make
deleted file mode 100644
index 0a0602ebd56..00000000000
--- a/contrib/go/_std_1.25/src/crypto/hkdf/ya.make
+++ /dev/null
@@ -1,12 +0,0 @@
-# THIS FILE IS AUTOGENERATED, DO NOT EDIT !!!
-# Generator: ya tool yamaker ym2; contrib/go/_std_{VER}/.yandex_meta/build.ym; contrib/go/yagogen/gen.py
-# Docs: https://a.yandex-team.ru/arcadia/devtools/contrib/docs/toolchain_go.md
-
-
-GO_LIBRARY()
-IF (OS_DARWIN AND ARCH_ARM64 AND RACE AND CGO_ENABLED OR OS_DARWIN AND ARCH_ARM64 AND RACE AND NOT CGO_ENABLED OR OS_DARWIN AND ARCH_ARM64 AND NOT RACE AND CGO_ENABLED OR OS_DARWIN AND ARCH_ARM64 AND NOT RACE AND NOT CGO_ENABLED OR OS_DARWIN AND ARCH_X86_64 AND RACE AND CGO_ENABLED OR OS_DARWIN AND ARCH_X86_64 AND RACE AND NOT CGO_ENABLED OR OS_DARWIN AND ARCH_X86_64 AND NOT RACE AND CGO_ENABLED OR OS_DARWIN AND ARCH_X86_64 AND NOT RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_AARCH64 AND RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_AARCH64 AND RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_AARCH64 AND NOT RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_AARCH64 AND NOT RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_X86_64 AND RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_X86_64 AND RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_X86_64 AND NOT RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_X86_64 AND NOT RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_ARM6 AND RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_ARM6 AND RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_ARM6 AND NOT RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_ARM6 AND NOT RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_ARM7 AND RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_ARM7 AND RACE AND NOT CGO_ENABLED OR OS_LINUX AND ARCH_ARM7 AND NOT RACE AND CGO_ENABLED OR OS_LINUX AND ARCH_ARM7 AND NOT RACE AND NOT CGO_ENABLED OR OS_WINDOWS AND ARCH_X86_64 AND RACE AND CGO_ENABLED OR OS_WINDOWS AND ARCH_X86_64 AND RACE AND NOT CGO_ENABLED OR OS_WINDOWS AND ARCH_X86_64 AND NOT RACE AND CGO_ENABLED OR OS_WINDOWS AND ARCH_X86_64 AND NOT RACE AND NOT CGO_ENABLED OR OS_ANDROID AND ARCH_ARM64 AND RACE AND CGO_ENABLED OR OS_ANDROID AND ARCH_ARM64 AND RACE AND NOT CGO_ENABLED OR OS_ANDROID AND ARCH_ARM64 AND NOT RACE AND CGO_ENABLED OR OS_ANDROID AND ARCH_ARM64 AND NOT RACE AND NOT CGO_ENABLED OR OS_EMSCRIPTEN AND ARCH_WASM32 AND RACE AND CGO_ENABLED OR OS_EMSCRIPTEN AND ARCH_WASM32 AND RACE AND NOT CGO_ENABLED OR OS_EMSCRIPTEN AND ARCH_WASM32 AND NOT RACE AND CGO_ENABLED OR OS_EMSCRIPTEN AND ARCH_WASM32 AND NOT RACE AND NOT CGO_ENABLED)
- SRCS(
- hkdf.go
- )
-ENDIF()
-END()