Skip to content

Commit

Permalink
Merge ed25519 authentication into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed May 26, 2019
2 parents e4dbf4f + 429fcaf commit fe578cf
Show file tree
Hide file tree
Showing 48 changed files with 4,081 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .ci/config/config.compression.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;UseCompression=true;DefaultCommandTimeout=3600",
"PasswordlessUser": "no_password",
"SecondaryDatabase": "testdb2",
"UnsupportedFeatures": "RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
"UnsupportedFeatures": "Ed25519,RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
"MySqlBulkLoaderLocalCsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.CSV",
"MySqlBulkLoaderLocalTsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.TSV"
}
Expand Down
2 changes: 1 addition & 1 deletion .ci/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;DefaultCommandTimeout=3600",
"PasswordlessUser": "no_password",
"SecondaryDatabase": "testdb2",
"UnsupportedFeatures": "RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
"UnsupportedFeatures": "Ed25519,RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
"MySqlBulkLoaderLocalCsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.CSV",
"MySqlBulkLoaderLocalTsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.TSV"
}
Expand Down
5 changes: 5 additions & 0 deletions .ci/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ for i in `seq 1 30`; do
if [ $? -ne 0 ]; then continue; fi
fi

if [[ $OMIT_FEATURES != *"Ed25519"* ]]; then
docker exec -it $NAME bash -c 'mysql -uroot -ptest < /etc/mysql/conf.d/init_ed25519.sql' >/dev/null 2>&1
if [ $? -ne 0 ]; then continue; fi
fi

# exit if successful
docker exec -it $NAME mysql -ussltest -ptest \
--ssl-mode=REQUIRED \
Expand Down
3 changes: 3 additions & 0 deletions .ci/server/init_ed25519.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
INSTALL SONAME 'auth_ed25519';
CREATE USER 'ed25519user'@'%' IDENTIFIED VIA ed25519 USING PASSWORD('Ed255!9');
GRANT ALL PRIVILEGES ON *.* TO 'ed25519user'@'%';
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ services: docker
env:
- IMAGE=mysql:5.6
NAME=mysql
OMIT_FEATURES=Json,Sha256Password,RsaEncryption,LargePackets,CachingSha2Password,SessionTrack,Tls11,Tls12,UuidToBin
OMIT_FEATURES=Ed25519,Json,Sha256Password,RsaEncryption,LargePackets,CachingSha2Password,SessionTrack,Tls11,Tls12,UuidToBin
- IMAGE=mysql:5.7
NAME=mysql
OMIT_FEATURES=RsaEncryption,CachingSha2Password,Tls12,UuidToBin
OMIT_FEATURES=Ed25519,RsaEncryption,CachingSha2Password,Tls12,UuidToBin
- IMAGE=mysql:8.0
NAME=mysql
OMIT_FEATURES=None
OMIT_FEATURES=Ed25519
- IMAGE=percona:5.7.22
NAME=percona
OMIT_FEATURES=CachingSha2Password,UuidToBin
OMIT_FEATURES=CachingSha2Password,Ed25519,UuidToBin
- IMAGE=mariadb:10.2
NAME=mariadb
OMIT_FEATURES=Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
OMIT_FEATURES=Ed25519,Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
- IMAGE=mariadb:10.3
NAME=mariadb
OMIT_FEATURES=Ed25519,Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
- IMAGE=mariadb:10.4
NAME=mariadb
OMIT_FEATURES=Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin

Expand Down
6 changes: 6 additions & 0 deletions MySqlConnector.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MySqlConnector.Logging.Seri
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MySqlConnector.Logging.NLog", "src\MySqlConnector.Logging.NLog\MySqlConnector.Logging.NLog.csproj", "{92015BEE-563A-4595-9243-0510D2B8767F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MySqlConnector.Authentication.Ed25519", "src\MySqlConnector.Authentication.Ed25519\MySqlConnector.Authentication.Ed25519.csproj", "{5DB4FA2E-910B-47CE-B467-F6852104D567}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -62,6 +64,10 @@ Global
{92015BEE-563A-4595-9243-0510D2B8767F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92015BEE-563A-4595-9243-0510D2B8767F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92015BEE-563A-4595-9243-0510D2B8767F}.Release|Any CPU.Build.0 = Release|Any CPU
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DB4FA2E-910B-47CE-B467-F6852104D567}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;

namespace Chaos.NaCl.Internal.Ed25519Ref10
{
internal struct FieldElement
{
internal int x0;
internal int x1;
internal int x2;
internal int x3;
internal int x4;
internal int x5;
internal int x6;
internal int x7;
internal int x8;
internal int x9;

//public static readonly FieldElement Zero = new FieldElement();
//public static readonly FieldElement One = new FieldElement() { x0 = 1 };

internal FieldElement(params int[] elements)
{
InternalAssert.Assert(elements.Length == 10, "elements.Length != 10");
x0 = elements[0];
x1 = elements[1];
x2 = elements[2];
x3 = elements[3];
x4 = elements[4];
x5 = elements[5];
x6 = elements[6];
x7 = elements[7];
x8 = elements[8];
x9 = elements[9];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;

namespace Chaos.NaCl.Internal.Ed25519Ref10
{
/*
ge means group element.
Here the group is the set of pairs (x,y) of field elements (see fe.h)
satisfying -x^2 + y^2 = 1 + d x^2y^2
where d = -121665/121666.
Representations:
ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
ge_precomp (Duif): (y+x,y-x,2dxy)
*/

internal struct GroupElementP2
{
public FieldElement X;
public FieldElement Y;
public FieldElement Z;
} ;

internal struct GroupElementP3
{
public FieldElement X;
public FieldElement Y;
public FieldElement Z;
public FieldElement T;
} ;

internal struct GroupElementP1P1
{
public FieldElement X;
public FieldElement Y;
public FieldElement Z;
public FieldElement T;
} ;

internal struct GroupElementPreComp
{
public FieldElement yplusx;
public FieldElement yminusx;
public FieldElement xy2d;

public GroupElementPreComp(FieldElement yplusx, FieldElement yminusx, FieldElement xy2d)
{
this.yplusx = yplusx;
this.yminusx = yminusx;
this.xy2d = xy2d;
}
} ;
}
Loading

0 comments on commit fe578cf

Please sign in to comment.