Skip to content

Commit 9501676

Browse files
committed
Merge branch 'synchronize-runtime-init-android' of github.com:matouskozak/runtime into synchronize-runtime-init-android
2 parents d2f611e + 6296e3c commit 9501676

File tree

11 files changed

+3026
-3
lines changed

11 files changed

+3026
-3
lines changed

MemMove_1

Lines changed: 351 additions & 0 deletions
Large diffs are not rendered by default.

MemMove_2

Lines changed: 648 additions & 0 deletions
Large diffs are not rendered by default.

logcat.txt

Lines changed: 1131 additions & 0 deletions
Large diffs are not rendered by default.

src/libraries/Common/src/System/Security/Cryptography/DSAAndroid.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using System.IO;
77
using Internal.Cryptography;
88
using Microsoft.Win32.SafeHandles;
9+
using System.Runtime.CompilerServices;
10+
911

1012
namespace System.Security.Cryptography
1113
{
@@ -202,6 +204,8 @@ protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm)
202204
protected override bool TryHashData(ReadOnlySpan<byte> data, Span<byte> destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) =>
203205
CryptographicOperations.TryHashData(hashAlgorithm, data, destination, out bytesWritten);
204206

207+
208+
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
205209
public override byte[] CreateSignature(byte[] rgbHash)
206210
{
207211
ArgumentNullException.ThrowIfNull(rgbHash);
@@ -211,6 +215,16 @@ public override byte[] CreateSignature(byte[] rgbHash)
211215
int signatureFieldSize = Interop.AndroidCrypto.DsaSignatureFieldSize(key) * BitsPerByte;
212216
Span<byte> signDestination = stackalloc byte[SignatureStackBufSize];
213217

218+
// Console.Write("Key: ");
219+
// System.Console.WriteLine(key);
220+
// Console.Write("rgbHash: ");
221+
// for (int i = 0; i < rgbHash.Length; i++)
222+
// {
223+
// System.Console.Write($"{rgbHash[i]:X2}");
224+
// }
225+
// System.Console.WriteLine();
226+
// Console.Write("signatureSize: ");
227+
// System.Console.WriteLine(signatureSize);
214228
ReadOnlySpan<byte> derSignature = SignHash(rgbHash, signDestination, signatureSize, key);
215229
return AsymmetricAlgorithmHelpers.ConvertDerToIeee1363(derSignature, signatureFieldSize);
216230
}
@@ -286,6 +300,7 @@ protected override bool TryCreateSignatureCore(
286300
}
287301
}
288302

303+
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
289304
private static ReadOnlySpan<byte> SignHash(
290305
ReadOnlySpan<byte> hash,
291306
Span<byte> destination,
@@ -298,10 +313,30 @@ private static ReadOnlySpan<byte> SignHash(
298313
destination = new byte[signatureLength];
299314
}
300315

316+
// Console.Write("Key: ");
317+
// System.Console.WriteLine(key);
318+
// System.Console.Write("Hash: ");
319+
// for (int i = 0; i < hash.Length; i++)
320+
// {
321+
// System.Console.Write($"{hash[i]:X2}");
322+
// }
323+
// System.Console.WriteLine();
324+
// System.Console.Write("Destination: ");
325+
// for (int i = 0; i < destination.Length; i++)
326+
// {
327+
// System.Console.Write($"{destination[i]:X2}");
328+
// }
329+
// System.Console.WriteLine();
330+
// Console.WriteLine("Before DSASign interop call");
301331
if (!Interop.AndroidCrypto.DsaSign(key, hash, destination, out int actualLength))
302332
{
333+
// Console.WriteLine("DSASign interop failed");
334+
// Console.WriteLine("HelloWorld");
335+
// Console.Write("actualLength: ");
336+
// System.Console.WriteLine(actualLength);
303337
throw new CryptographicException();
304338
}
339+
// Console.WriteLine("After DSASign interop call");
305340

306341
Debug.Assert(
307342
actualLength <= signatureLength,

src/libraries/Microsoft.Bcl.AsyncInterfaces/src/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public void SetException(Exception error)
8686
/// <param name="token">Opaque value that was provided to the <see cref="ValueTask"/>'s constructor.</param>
8787
public ValueTaskSourceStatus GetStatus(short token)
8888
{
89+
Console.WriteLine("TODO: GetStatus");
8990
ValidateToken(token);
9091
return
9192
_continuation == null || !_completed ? ValueTaskSourceStatus.Pending :
@@ -101,6 +102,7 @@ public TResult GetResult(short token)
101102
ValidateToken(token);
102103
if (!_completed)
103104
{
105+
Internal.Console.Write("GetResults")
104106
throw new InvalidOperationException();
105107
}
106108

@@ -163,6 +165,7 @@ public void OnCompleted(Action<object?> continuation, object? state, short token
163165
// Operation already completed, so we need to queue the supplied callback.
164166
if (!ReferenceEquals(oldContinuation, ManualResetValueTaskSourceCoreShared.s_sentinel))
165167
{
168+
Internal.Console.Write("oldContinuation");
166169
throw new InvalidOperationException();
167170
}
168171

@@ -191,6 +194,9 @@ public void OnCompleted(Action<object?> continuation, object? state, short token
191194
/// <param name="token">The token supplied by <see cref="ValueTask"/>.</param>
192195
private void ValidateToken(short token)
193196
{
197+
Internal.Console.Write("ValidateToken");
198+
Internal.Console.Write(token);
199+
Internal.Console.Write(_version);
194200
if (token != _version)
195201
{
196202
throw new InvalidOperationException();
@@ -202,6 +208,7 @@ private void SignalCompletion()
202208
{
203209
if (_completed)
204210
{
211+
Internal.Console.Write("_completed");
205212
throw new InvalidOperationException();
206213
}
207214
_completed = true;
@@ -265,6 +272,7 @@ internal static class ManualResetValueTaskSourceCoreShared // separated out of g
265272
private static void CompletionSentinel(object? _) // named method to aid debugging
266273
{
267274
Debug.Fail("The sentinel delegate should never be invoked.");
275+
Internal.Console.Write("completionsentinel");
268276
throw new InvalidOperationException();
269277
}
270278
}

src/libraries/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ public void AsymmetricDSASignature()
300300

301301
DSA key = TestHelpers.GetWorkingDSA();
302302
signedXml.SigningKey = key;
303-
303+
// Console.Write("Generated key: ");
304+
// Console.WriteLine(key.ToXmlString(true));
304305
// Add a KeyInfo.
305306
KeyInfo keyInfo = new KeyInfo();
306307
keyInfo.AddClause(new DSAKeyValue(key));

src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricSignatureFormatter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public virtual byte[] CreateSignature(HashAlgorithm hash)
1818

1919
SetHashAlgorithm(hash.ToAlgorithmName()!);
2020
Debug.Assert(hash.Hash != null);
21+
// Console.Write("hash.Hash: ");
22+
// Console.WriteLine(hash.Hash);
2123
return CreateSignature(hash.Hash);
2224
}
2325

src/mono/sample/Android/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
BUILD_CONFIG=Release
2-
TARGET_ARCH?=x64
1+
BUILD_CONFIG=Debug
2+
TARGET_ARCH?=arm64
33
DOTNET := ../../../../dotnet.sh
44
USE_LLVM=true
55
AOT=false

0 commit comments

Comments
 (0)