<div dir="ltr">
<div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
First, how do I get at them?  <br></blockquote><div><br><br>
I would take the easiest opensource approach and look (steal) how the<br>
others do.<br>
<br>
For example, OpenSSL does something similar here:<br>
<a href="https://github.com/openssl/openssl/blob/master/crypto/aes/asm/aesni-x86_64.pl" target="_blank">https://github.com/openssl/openssl/blob/master/crypto/aes/asm/aesni-x86_64.pl</a><br>
<br>
<br>
And Intel has a bunch of docs here:<br>
<a href="http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni/" target="_blank">http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni/</a><br>

(There's even sample code)<br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Second, is there a way to detect whether or not that hardware<br>

is present, so that I can create something that may run more<br>
slowly but at least doesn't crash horribly if run on an<br>
earlier CPU without an AES instruction built in?<br>
<br></blockquote><div><br><br>
>From this direction, I strongly recommend that you use preexisting<br>
crypto library that already implements this (also with the fallback).<br>
There's also a nice (my personal favourite) article on that:<br>
<a href="http://www.cs.berkeley.edu/%7Edaw/teaching/cs261-f12/misc/if.html" target="_blank">http://www.cs.berkeley.edu/~daw/teaching/cs261-f12/misc/if.html</a><br>
<br>
Hope that helps,<br>-mk<br></div></div></div></div>