Skip to content

Commit

Permalink
Don't hardcode the HPKE cipher
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Jun 7, 2021
1 parent 72a354c commit d5e9ed3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions dnscrypt-proxy/oblivious_doh.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"crypto/aes"
"crypto/cipher"
"crypto/subtle"
"encoding/binary"
"fmt"
Expand Down Expand Up @@ -157,12 +155,7 @@ func (q ODoHQuery) decryptResponse(response []byte) ([]byte, error) {
return nil, err
}

block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}

aesgcm, err := cipher.NewGCM(block)
cipher, err := q.suite.NewRawCipher(key)
if err != nil {
return nil, err
}
Expand All @@ -175,7 +168,7 @@ func (q ODoHQuery) decryptResponse(response []byte) ([]byte, error) {
ct := response[5+int(responseNonceLength):]
aad := response[0 : 3+int(responseNonceLength)]

responsePlaintext, err := aesgcm.Open(nil, nonce, ct, aad)
responsePlaintext, err := cipher.Open(nil, nonce, ct, aad)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d5e9ed3

Please sign in to comment.