net/http: migrate to crypto/hash APIs
MERGED2026nethttpcrypto
2026. 8. 13.
tomatozil
net/http에서 사용 중인 기존 crypto/sha2 API를 새로운 crypto/hash API로 전환함. API 변경에 따라 상수와 SHA-256 함수 호출을 수정하고, 더 이상 필요하지 않은 crypto/sha2.h 및 crypto/secure_hash.h 헤더를 제거함.
문제 설명
net/http 일부 코드가 SHA-256 해시 계산을 위해 기존 API를 사용하고 있었음.
crypto/sha2.h
crypto::SHA256Hash()
crypto::kSHA256Length
또한 일부 테스트 파일에는 실제로 사용되지 않는 다음 헤더가 남아 있었음.
crypto/sha2.h
crypto/secure_hash.h
해결 내용
cSHA-256 관련 구현을 crypto/hash API로 마이그레이션함.
전
#include "crypto/sha2.h"
using HashedHost = std::array<uint8_t, crypto::kSHA256Length>;
return crypto::SHA256Hash(pickle.payload_bytes());후
#include "crypto/hash.h"
using HashedHost =
std::array<uint8_t, crypto::hash::kSha256Size>;
return crypto::hash::Sha256(pickle.payload_bytes());테스트 방법
변경과 관련된 단위 테스트
autoninja -C out/Default net_unittests
out/Default/net_unittests \
--gtest_filter='WritersTest.*:CookieIndicesTest.*:HttpSecurityHeadersTest.*:TransportSecurityStateTest.*:TransportSecurityStateStaticTest.*'전체(?) 단위 테스트
out/Default/net_unittests근데 이 때 실패하는 항목들이 나왔음 -> 알고보니 이번 변경때문에 발생하는 실패는 아니고 경로 설정이 잘못됐거나 권한 문제(로컬 문제)인 것으로 추정됨.
변경 전 후 단위테스트 결과 비교
변경을 롤백하고 단위테스트를 실행하여 변경 후 단위테스트 결과와 비교했음.
배운 점
- gerrit 사용법과 git 사용법
- chromium 기여 흐름
- CQ 권한이 없는 것은 매우 불편한 일이구나