Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Support for tidb_sm3_password authentication #36193

Merged
merged 43 commits into from
Sep 8, 2022
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
21d6d9a
*: Support for sm3_password authentication
CbcWestwolf Jul 13, 2022
77ec1f7
Fix
CbcWestwolf Jul 13, 2022
3676087
Fix
CbcWestwolf Jul 13, 2022
2699659
Merge branch 'master' of github.com:pingcap/tidb into support_sm3
CbcWestwolf Jul 13, 2022
d1b0c83
Merge branch 'master' into support_sm3
CbcWestwolf Jul 13, 2022
3972d00
Merge branch 'master' of github.com:pingcap/tidb into support_sm3
CbcWestwolf Jul 14, 2022
d080a88
implement sm3 like caching_sha2
CbcWestwolf Jul 14, 2022
3aba797
Update parser/auth/sm3.go
CbcWestwolf Jul 15, 2022
711736b
Update
CbcWestwolf Jul 15, 2022
4b68cb6
Merge branch 'master' of github.com:pingcap/tidb into support_sm3
CbcWestwolf Jul 15, 2022
0b79e73
Update
CbcWestwolf Jul 15, 2022
45340e3
Update bazel
CbcWestwolf Jul 15, 2022
f9badbb
Merge branch 'master' into support_sm3
CbcWestwolf Jul 18, 2022
e64e902
Fix
CbcWestwolf Jul 18, 2022
edd2ae6
Fix
CbcWestwolf Jul 18, 2022
59cc76e
Fix
CbcWestwolf Jul 18, 2022
6b5cb33
Support bulitin function SM3(str)
CbcWestwolf Jul 18, 2022
a98c4e2
Add license from Suzhou Tongji Fintech Research Institute
CbcWestwolf Jul 18, 2022
69d779a
Fix
CbcWestwolf Jul 18, 2022
cf565a8
Add test for builtin SM3()
CbcWestwolf Jul 18, 2022
92f2dc5
Merge branch 'master' of github.com:pingcap/tidb into support_sm3
CbcWestwolf Jul 19, 2022
e11e90e
Add test for SM3
CbcWestwolf Jul 19, 2022
d893f3d
Fix
CbcWestwolf Jul 19, 2022
9da7846
Fix
CbcWestwolf Jul 19, 2022
cbd467e
Fix UT
CbcWestwolf Jul 19, 2022
64516b5
Fix
CbcWestwolf Jul 19, 2022
661f720
Fix
CbcWestwolf Jul 19, 2022
1ab815b
Fix
CbcWestwolf Jul 21, 2022
1c54ff0
Merge branch 'master' into support_sm3
CbcWestwolf Jul 22, 2022
da28c9e
Merge branch 'master' into support_sm3
CbcWestwolf Jul 22, 2022
2a496f5
Merge branch 'master' of github.com:pingcap/tidb into support_sm3
CbcWestwolf Aug 27, 2022
9db5b4d
Fix
CbcWestwolf Aug 28, 2022
8e09189
Update parser/auth/sm3.go
CbcWestwolf Sep 2, 2022
a888612
Update
CbcWestwolf Sep 5, 2022
2c472fc
Merge branch 'support_sm3' of github.com:CbcWestwolf/tidb into suppor…
CbcWestwolf Sep 5, 2022
511afe8
Merge branch 'master' into support_sm3
CbcWestwolf Sep 6, 2022
9a08797
Update
CbcWestwolf Sep 6, 2022
ffa4176
Fix
CbcWestwolf Sep 6, 2022
eda8c41
Improve compatibility
CbcWestwolf Sep 7, 2022
0012cc4
Fix UT
CbcWestwolf Sep 7, 2022
9ed13ae
Merge branch 'master' into support_sm3
CbcWestwolf Sep 8, 2022
e53ad3e
Merge branch 'master' into support_sm3
ti-chi-bot Sep 8, 2022
d2e2858
Merge branch 'master' into support_sm3
ti-chi-bot Sep 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
CbcWestwolf committed Aug 28, 2022
commit 9db5b4de43204f3cd9f4bbabe749bc3bc14dfd6d
11 changes: 5 additions & 6 deletions server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,17 +753,16 @@ func (cc *clientConn) authSha(ctx context.Context) ([]byte, error) {

// authSM3 implements the sm3_password specific part of the protocol.
func (cc *clientConn) authSM3(ctx context.Context) ([]byte, error) {

const (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we a single list or this and caching_sha2_password?

SM3Command = 1
RequestRsaPubKey = 2 // Not supported yet, only TLS is supported as secure channel.
FastAuthOk = 3
FastAuthFail = 4
sm3Command = 1
requestRsaPubKey = 2 // Not supported yet, only TLS is supported as secure channel.
fastAuthOk = 3
fastAuthFail = 4
)

// Currently we always send a "FastAuthFail" as the cached part of the protocol isn't implemented yet.
// This triggers the client to send the full response.
err := cc.writePacket([]byte{0, 0, 0, 0, SM3Command, FastAuthFail})
err := cc.writePacket([]byte{0, 0, 0, 0, sm3Command, fastAuthFail})
if err != nil {
logutil.Logger(ctx).Error("authSM3 packet write failed", zap.Error(err))
return nil, err
Expand Down