File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -358,12 +358,10 @@ func (h *evpHash) Clone() (HashCloner, error) {
358
358
panic (err )
359
359
}
360
360
if _ , err := ossl .EVP_MD_CTX_copy_ex (h2 .ctx , h .ctx ); err != nil {
361
- ossl .EVP_MD_CTX_free (h2 .ctx )
362
361
panic (err )
363
362
}
364
363
h2 .ctx2 , err = ossl .EVP_MD_CTX_new ()
365
364
if err != nil {
366
- ossl .EVP_MD_CTX_free (h2 .ctx )
367
365
panic (err )
368
366
}
369
367
runtime .SetFinalizer (h2 , (* evpHash ).finalize )
Original file line number Diff line number Diff line change @@ -251,11 +251,10 @@ func (h *opensslHMAC) Clone() (HashCloner, error) {
251
251
case 1 :
252
252
ctx2 , err := ossl .HMAC_CTX_new ()
253
253
if err != nil {
254
- return nil , err
254
+ panic ( err )
255
255
}
256
256
if _ , err := ossl .HMAC_CTX_copy (ctx2 , h .ctx1 .ctx ); err != nil {
257
- ossl .HMAC_CTX_free (ctx2 )
258
- return nil , err
257
+ panic (err )
259
258
}
260
259
cl := & opensslHMAC {
261
260
ctx1 : hmacCtx1 {ctx : ctx2 },
@@ -268,11 +267,9 @@ func (h *opensslHMAC) Clone() (HashCloner, error) {
268
267
case 3 :
269
268
ctx2 , err := ossl .EVP_MAC_CTX_dup (h .ctx3 .ctx )
270
269
if err != nil {
271
- return nil , err
270
+ panic ( err )
272
271
}
273
272
274
- // For OpenSSL 3.0.0, 3.0.1, and 3.0.2 we need to copy the key
275
- // from the original context to the new one.
276
273
cl := & opensslHMAC {
277
274
ctx3 : hmacCtx3 {ctx : ctx2 , key : slices .Clone (h .ctx3 .key )},
278
275
size : h .size ,
You can’t perform that action at this time.
0 commit comments