<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 7 September 2017 at 04:20, Sahana Prasad <span dir="ltr"><<a href="mailto:sahana.prasad07@gmail.com" target="_blank">sahana.prasad07@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Wed, Sep 6, 2017 at 5:38 PM, D. Hugh Redelmeier <span dir="ltr"><<a href="mailto:hugh@mimosa.com" target="_blank">hugh@mimosa.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Perhaps I'm old fashioned but we have avoided putting static things in<br>
headers.<br>
<br>
- they notionally take resources in every compilation unit that includes<br>
  the header.  (But smart compilers can eliminate unused instances.)<br>
<br>
- .h files are about sharing and static things are not shared<br>
<br>
Exception: inline functions.  An inline function is useful as a cleaner<br>
replacement for macros.  If I remember correctly, making an inline<br>
function static makes the semantics simpler allowing a compiler to do<br>
a better job.<br>
<br>
Currently the only exceptions I see are:<br>
<br>
linux/include/des/podd.h:59:st<wbr>atic const unsigned char odd_parity[256] = {<br>
linux/include/des/sk.h:59:stat<wbr>ic const DES_LONG des_skb[8][64] = {<br>
osxApp/MainMenuController.h:20<wbr>:static AuthorizationRef gAuth;<br>
<br>
include/ietf_constants.h:1696:<wbr>static const unsigned char sha1_rsa_oid_blob[ASN1_SHA1_RS<wbr>A_OID_SIZE] = {0x30,0x0d,0x06,0x09,0x2a,0x86<wbr>,0x48,0x86,0xf7,0x0d,0x01,0x01<wbr>,0x05,0x05,0x00};<br>
include/ietf_constants.h:1698:<wbr>static const uint8_t len_sha1_rsa_oid_blob[ASN1_LEN<wbr>_ALGO_IDENTIFIER] = {ASN1_SHA1_RSA_OID_SIZE};<br>
<br>
<br>
The first three are in imported code and should not be changed. The second<br>
two, in my opinion, ought to be eliminated (definitions moved).<br>
<br></blockquote></span><div><font color="#741b47">I will change this. Thank you for the comments.</font></div><div><font color="#741b47">This was implemented in a hard coded way for one value. But , in future there are many such blobs of varying lengths that would be used. So, this hardcoding shall be removed.</font></div></div></div></div></blockquote><div><br>Does NSS know the value?  We already do this:<br><br>programs/pluto/ike_alg_nss_ecp.c:    SECOidData *pk11_data = SECOID_FindOIDByTag(group->nss_oid);<br>lib/libswan/ike_alg_dh.c:    .nss_oid = SEC_OID_SECG_EC_SECP256R1,<br>lib/libswan/ike_alg_dh.c:    .nss_oid = SEC_OID_SECG_EC_SECP384R1,<br>lib/libswan/ike_alg_dh.c:    .nss_oid = SEC_OID_SECG_EC_SECP521R1,<br><br>else, I'd stick with something simple in the header:<br><br>#define SHA1_RSA_OID <span class="gmail-">{0x30,0x0d,0x06,0x09,0x2a,0x86<wbr>,0x48,0x86,0xf7,0x0d,0x01,0x01<wbr>,0x05,0x05,0x00}<br><br></span></div><div><br><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"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The objects defined in last two are only actually used one place so<br>
there is probably no serious consequence to the current code.<br>
<br>
______________________________<wbr>_________________<br>
Swan-dev mailing list<br>
<a href="mailto:Swan-dev@lists.libreswan.org" target="_blank">Swan-dev@lists.libreswan.org</a><br>
<a href="https://lists.libreswan.org/mailman/listinfo/swan-dev" rel="noreferrer" target="_blank">https://lists.libreswan.org/ma<wbr>ilman/listinfo/swan-dev</a><br>
</blockquote></span></div><br></div></div>
<br>______________________________<wbr>_________________<br>
Swan-dev mailing list<br>
<a href="mailto:Swan-dev@lists.libreswan.org">Swan-dev@lists.libreswan.org</a><br>
<a href="https://lists.libreswan.org/mailman/listinfo/swan-dev" rel="noreferrer" target="_blank">https://lists.libreswan.org/<wbr>mailman/listinfo/swan-dev</a><br>
<br></blockquote></div><br></div></div>