[148825] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

Re: [Cryptography] how reliably do audits spot backdoors?

daemon@ATHENA.MIT.EDU (CodesInChaos)
Sun Dec 29 22:56:40 2013

X-Original-To: cryptography@metzdowd.com
In-Reply-To: <52C08F0A.2070303@iang.org>
Date: Mon, 30 Dec 2013 04:29:36 +0100
From: CodesInChaos <codesinchaos@gmail.com>
To: ianG <iang@iang.org>
Cc: Cryptography Mailing List <cryptography@metzdowd.com>
Errors-To: cryptography-bounces+crypto.discuss=bloom-picayune.mit.edu@metzdowd.com

On Sun, Dec 29, 2013 at 10:07 PM, ianG <iang@iang.org> wrote:
> Does C# have this problem?

C# has the using statement, which is a bit of syntax over try-finally,
probably similar to try-with-resources in java. Typically looks like

using(var file = File.Open(path))
{
  // do something with file
}

> And, what actually happens if the close() isn't called?

For C# it works like this, for java it's probably similar: For
disposable classes that implement both `Dispose`/`Close` and a
finalizer, when the GC attempts to collect the object it runs the
finalizer which releases the resources. But there are some issues with
that:

* The GC can collect the object much later. So if your resource is
expensive, that can be unacceptable. For filestreams it might keep
files locked for an indefinite amount of time. This is the main reason
why manual disposing is recommended.
* there are some tricky cases regarding multi-threading and locking
* finalization happens in undefined order. This can be tricky if
resources depend on each other.
_______________________________________________
The cryptography mailing list
cryptography@metzdowd.com
http://www.metzdowd.com/mailman/listinfo/cryptography

home help back first fref pref prev next nref lref last post