Bug 505 - Linker removes SHA256 even when HMACSHA256 is used
Summary: Linker removes SHA256 even when HMACSHA256 is used
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 4.x
Hardware: All Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2011-08-28 19:34 UTC by Sebastien Pouliot
Modified: 2011-08-29 11:17 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Sebastien Pouliot 2011-08-28 19:34:26 UTC
I tested that on xtouch - but I likely forgot to backport (part of) it.
Comment 2 Sebastien Pouliot 2011-08-28 19:37:20 UTC
Two workarounds are:

a) add "--linkskip=mscorlib" to the "extra mtouch arguments" (Project Options, iPhone Build). This will skip 'mscorlib.dll' from being processed by the linker and will ensure SHA256 is still available to your application;

b) create an instance of SHA256Managed in your application (even if you do not directly use it). That'll "trick" the linker into including it into your application.

The first option is easier (to add now and remove later) but will make your application a bit larger. The second one is more optimal (for the application size) but a less clean on your code.
Comment 3 Steven Hope 2011-08-28 20:46:33 UTC
This bug affects all HMAC hash types except for HMACSHA1, it is not limited to only HMACSHA256.

Simple workaround code for "option b" above is to put this in your main.cs...

System.Security.Cryptography.SHA256Managed tempCode = new System.Security.Cryptography.SHA256Managed();
Comment 4 Sebastien Pouliot 2011-08-29 11:17:06 UTC
So I was wrong (about being wrong ;-). The backports (from comment #1) were done but after MonoTouch 4.0.4 was branched (and 4.0.6 was built from that stable branch).

As such the fix is already available in MonoTouch 4.1 (beta) and will be part of 4.2 (stable) once released.