Skip to content

Commit 5c7f06b

Browse files
committed
统一前缀
1 parent a83ad6b commit 5c7f06b

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

drbg/common.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,20 +265,20 @@ func (hd *BaseDrbg) setSecurityLevel(securityLevel SecurityLevel) {
265265
// Destroy 对 GM/T 0105-2021 B.2、E.2 对内部状态进行清零处理
266266
// 内部状态组成为 {V,C, reseed_counter, last_reseed_time,reseed_interval_in_counter, reseed_interval_in_time}
267267
// 内部状态组成为 {V,Key, reseed_counter, last_reseed_time,reseed_interval_in_counter, reseed_interval_in_time}
268-
func (cd *BaseDrbg) Destroy() {
269-
setZero(cd.v)
270-
cd.seedLength = 0
268+
func (hd *BaseDrbg) Destroy() {
269+
setZero(hd.v)
270+
hd.seedLength = 0
271271
for i := 0; i < 3; i++ {
272272
// 使用原子操作防止编译器优化
273-
atomic.StoreUint64(&cd.reseedCounter, 0xFFFFFFFFFFFFFFFF)
274-
atomic.StoreUint64(&cd.reseedCounter, 0x00)
275-
atomic.StoreUint64(&cd.reseedIntervalInCounter, 0xFFFFFFFFFFFFFFFF)
276-
atomic.StoreUint64(&cd.reseedIntervalInCounter, 0x00)
273+
atomic.StoreUint64(&hd.reseedCounter, 0xFFFFFFFFFFFFFFFF)
274+
atomic.StoreUint64(&hd.reseedCounter, 0x00)
275+
atomic.StoreUint64(&hd.reseedIntervalInCounter, 0xFFFFFFFFFFFFFFFF)
276+
atomic.StoreUint64(&hd.reseedIntervalInCounter, 0x00)
277277
// 将 reseedIntervalInTime 设置内存屏障,防止编译器优化
278-
cd.reseedIntervalInTime = time.Duration(1<<63 - 1)
279-
runtime.KeepAlive(&cd.reseedIntervalInTime)
280-
cd.reseedIntervalInTime = time.Duration(0)
281-
cd.reseedTime = time.Now()
278+
hd.reseedIntervalInTime = time.Duration(1<<63 - 1)
279+
runtime.KeepAlive(&hd.reseedIntervalInTime)
280+
hd.reseedIntervalInTime = time.Duration(0)
281+
hd.reseedTime = time.Now()
282282
}
283283
}
284284

0 commit comments

Comments
 (0)