Re: CRL validation must be skipped for certs with no CRLDPs

2011-03-19 Thread Bruce Stephens
Jeff Saremi  writes:

[...]

> Here's the code:
>
> cert.status = NOT_REVOKED;
> for (i = 0; i < cert.crldp.size; ++i)
> {
>   /* some processing loops */
>   if(cert.status == UNDETERMINED)
>   {
> /* do what Bruce Stephens suggested */
>   }
> }

No, I think RFC5280 is saying that you may have CRLs which were not
indicated by CRLDP.  Even if there is no CRLDP at all, you may have
(through some other means) CRLs issued by some appropriate entity
(either the CA or a indirect CRL issuer).

If you don't have any of those (and you don't have any other mechanism
for verifying revocation status, such as OCSP) then that surely
shouldn't mean that the certificate is not revoked---it surely ought to
mean you don't know?

When designing your own applications you might reasonably choose to
regard such certificates as valid, or (alternatively) to reject them on
the grounds that revocation status can't be checked.  Both seem
reasonable choices, depending on the circumstances.

I'm not sure what you should do if you're issuing certificates and want
people to always regard them as unrevoked.  I suspect it depends how
much control you have over the software that other people are using.  At
worst you might need to produce CRLs (which would always be empty) or
run an OCSP server.

[...]

> Now as a result of OpenSSL's imlementation, none of my clients who use
> OpenSSL will be able to deal with me online.

I don't think it has anything to do with OpenSSL.  Other verifiers will
behave similarly (I happen to be familiar with CML and that'll behave
the same as OpenSSL, if revocation checking is enabled).

> Because my certificates do not have a CRL and CRLDP period. Should I
> stop doing business altogether? Should I contact my business partners
> and tell them that they should be applying a patch to their code,
> overriding verification failure in their certVerifyCallbacks? Let's
> just think that through a little.

If you want to support software that performs revocation checking then
you'll need to provide some way for that software to check revocation
status.  That might be simple (provide an empty CRL with a nextUpdate
way off in the future).

But maybe that's not necessary: for software that only really addresses
you certs, maybe you can persuade the software not to perform revocation
checking.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: elicptic Curve Key Generation

2011-03-19 Thread Sander Temme

On Mar 18, 2011, at 3:57 PM, Strecker, Dean A. wrote:

> I'm using the OpenSSL Crypto library to perform Elliptic Curve key
> generation and signature generation/verification.  Actually, I don't
> have any problem creating a key (EC_KEY) and generating signatures and
> verifying signatures using pure OpenSSL.
> 
> The challenge I'm having is that I'm using a Hardware Security Module
> (HSM) to generate the private key and the public key point (X, Y).  I

What model of HSM?  And how are you integrating with it? 

> thought I might be able to initialize the EC_KEY->priv_key and
> EC_KEY->pub_key with the data generated by the HSM before calling
> EC_KEY_generate_key(EC_KEY). 

Are you exporting the key material once generated, or are you looking to use it 
while under protection by the HSM? 

S.

> I was hoping this would act as an "Import" key action.  Wrong!
> EC_KEY_generate_key generates new private and public key point
> overriding the private and public key point passed into the
> EC_KEY_generate_key function.
> 
> Since OpenSSL supports importing of keys, well from the command line
> anyhow, I can't help but think there must be a way to programmatically
> import an Elliptic Curve key (private key and public key point).
> 
> I have been studying the source coding starting with the call to
> EC_KEY_generate_key function and working my way down.  So far I have not
> figured out how to create an Elliptic Curve Key from a given private key
> and public key point.  Does anybody have any idea where I could look for
> an answer?  
> 
> Thank you,
> 
> Dean
> __
> OpenSSL Project http://www.openssl.org
> User Support Mailing Listopenssl-users@openssl.org
> Automated List Manager   majord...@openssl.org


-- 
san...@temme.net  http://www.temme.net/sander/
PGP FP: FC5A 6FC6 2E25 2DFD 8007  EE23 9BB8 63B0 F51B B88A

View my availability: http://tungle.me/sctemme

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


SEGV in engine_table_select

2011-03-19 Thread John Hascall

I'm getting a frequent (but not always) crash in the
engine_table_select() routine at offset +206
(a full stack trace is below) in openssl-0.9.8q
(as called by curl-7.21.4) under NetBSD 3.1.1.

I have attempted to line up the C source with
the object code as disassembled by GDB, and
it appears that the issue is here:

trynext:
ret = sk_ENGINE_value(fnd->sk, loop++);
0xbd964e70 :   call   0xbd8e993c 
0xbd964e75 :   add$0x10,%esp

if(!ret)
0xbd964e78 :   test   %eax,%eax
0xbd964e7a :   mov%eax,%edi
0xbd964e7c :   je 

/* ret is not NULL */
if((ret->funct_ref > 0) || ...
0xbd964e7e :   mov0x44(%eax),%eax  <= SEGV HERE
0xbd964e81 :   test   %eax,%eax
0xbd964e83 :   jle

It appears that ret has a value which is not a valid pointer:

(gdb) info registers eax
eax0x404040467372036

so the attempt to dereference it to get to ret->funct_ref SEGFAULTS.


I found one somewhat similar report from many years ago via google,
but no answer then.

Anyone have any ideas on what might be causing this or how to look further?

Thanks,
John

Full stack trace:
#0  0xbd964e7e in engine_table_select () from /usr/lib/libcrypto.so.2
#1  0xbd9462ad in ENGINE_get_default_RAND () from /usr/lib/libcrypto.so.2
#2  0xbd945581 in RAND_get_rand_method () from /usr/lib/libcrypto.so.2
#3  0xbd9456c8 in RAND_add () from /usr/lib/libcrypto.so.2
#4  0xbd8ee237 in RAND_load_file () from /usr/lib/libcrypto.so.2
#5  0xbd89044a in ossl_seed () from /usr/pkg/lib/libcurl.so.4
#6  0xbd890589 in Curl_ossl_seed () from /usr/pkg/lib/libcurl.so.4
#7  0xbd891bb4 in ossl_connect_step1 () from /usr/pkg/lib/libcurl.so.4
#8  0xbd893d32 in ossl_connect_common () from /usr/pkg/lib/libcurl.so.4
#9  0xbd893d87 in Curl_ossl_connect () from /usr/pkg/lib/libcurl.so.4
#10 0xbd8a4ef5 in Curl_ssl_connect () from /usr/pkg/lib/libcurl.so.4
#11 0xbd881c22 in Curl_http_connect () from /usr/pkg/lib/libcurl.so.4
#12 0xbd88d7e4 in Curl_protocol_connect () from /usr/pkg/lib/libcurl.so.4
#13 0xbd88f80c in setup_conn () from /usr/pkg/lib/libcurl.so.4
#14 0xbd88f939 in Curl_connect () from /usr/pkg/lib/libcurl.so.4
#15 0xbd899f31 in connect_host () from /usr/pkg/lib/libcurl.so.4
#16 0xbd89a154 in Curl_do_perform () from /usr/pkg/lib/libcurl.so.4
#17 0xbd89a8f7 in curl_easy_perform () from /usr/pkg/lib/libcurl.so.4
#18 0x080f0843 in do_post () /* my code from here on down */

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: elicptic Curve Key Generation

2011-03-19 Thread Dr. Stephen Henson
On Fri, Mar 18, 2011, Strecker, Dean A. wrote:

> Hello,
> 
> I'm using the OpenSSL Crypto library to perform Elliptic Curve key
> generation and signature generation/verification.  Actually, I don't
> have any problem creating a key (EC_KEY) and generating signatures and
> verifying signatures using pure OpenSSL.
> 
> The challenge I'm having is that I'm using a Hardware Security Module
> (HSM) to generate the private key and the public key point (X, Y).  I
> thought I might be able to initialize the EC_KEY->priv_key and
> EC_KEY->pub_key with the data generated by the HSM before calling
> EC_KEY_generate_key(EC_KEY). 
> I was hoping this would act as an "Import" key action.  Wrong!
> EC_KEY_generate_key generates new private and public key point
> overriding the private and public key point passed into the
> EC_KEY_generate_key function.
> 
> Since OpenSSL supports importing of keys, well from the command line
> anyhow, I can't help but think there must be a way to programmatically
> import an Elliptic Curve key (private key and public key point).
> 
> I have been studying the source coding starting with the call to
> EC_KEY_generate_key function and working my way down.  So far I have not
> figured out how to create an Elliptic Curve Key from a given private key
> and public key point.  Does anybody have any idea where I could look for
> an answer?  
> 

In outline you do this:

Get an appopriate group for the curve, for example for a standard curve you
can use EC_GROUP_new_by_curve_name().

Create a new EC_KEY for the appopriate group using EC_KEY_new() and
EC_KEY_set_group().

Create a public key point for the group using EC_POINT_new() and
EC_POINT_set_affine_coordinates_*().

Set the key components in the EC_KEY using EC_KEY_set_public_key() and
EC_KEY_set_private_key().

Finally free up the group and point because the key has its own copies.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


elicptic Curve Key Generation

2011-03-19 Thread Strecker, Dean A.
Hello,

I'm using the OpenSSL Crypto library to perform Elliptic Curve key
generation and signature generation/verification.  Actually, I don't
have any problem creating a key (EC_KEY) and generating signatures and
verifying signatures using pure OpenSSL.

The challenge I'm having is that I'm using a Hardware Security Module
(HSM) to generate the private key and the public key point (X, Y).  I
thought I might be able to initialize the EC_KEY->priv_key and
EC_KEY->pub_key with the data generated by the HSM before calling
EC_KEY_generate_key(EC_KEY). 
I was hoping this would act as an "Import" key action.  Wrong!
EC_KEY_generate_key generates new private and public key point
overriding the private and public key point passed into the
EC_KEY_generate_key function.

Since OpenSSL supports importing of keys, well from the command line
anyhow, I can't help but think there must be a way to programmatically
import an Elliptic Curve key (private key and public key point).

I have been studying the source coding starting with the call to
EC_KEY_generate_key function and working my way down.  So far I have not
figured out how to create an Elliptic Curve Key from a given private key
and public key point.  Does anybody have any idea where I could look for
an answer?  

Thank you,

Dean
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: CRL validation must be skipped for certs with no CRLDPs

2011-03-19 Thread Jeff Saremi
I'm not sure how you read this. I read it like a programmer.
In programming primitives, the spec would be coded like this:

Here's the spec:
"This algorithm begins by assuming that the certificate is not revoked
For each distribution point (DP) in the certificate's CRL distribution
points extension, for each corresponding CRL "

And here's the C code:

cert.status = UNREVOKED;
for (i = 0; i < cert.crldp.size; ++i)
{
  /* more processing loops */
}

Right there, the main loop should not even execute because
cert.crldp.size is zero.
But let's play along and say that for some unknown reason we get to the
section of the spec you're referring to:

Here's the spec:

> I think you should read on.  Specifically, the last paragraph seems to
> me to indicate different behaviour is intended:
> 
>If the revocation status has not been determined, repeat the process
>above with any available CRLs not specified in a distribution point
>but issued by the certificate issuer.  

Here's the code:

cert.status = NOT_REVOKED;
for (i = 0; i < cert.crldp.size; ++i)
{
  /* some processing loops */
  if(cert.status == UNDETERMINED)
  {
/* do what Bruce Stephens suggested */
  }
}

As you can see again there's another stop and that stop is that our
certificate's status is not "UNDETERMINED" but rather "UNREVOKED".

But lets view this whole thing from another perspective:
I have a limited certificate authority in my organization. have a root
cert which does not get revoked. I distribute that to the ones who want
to deal with me. I also generate a multitude of endpoint certificates. I
do not intend for any of these to become revoked, ever. Hence, I do not
bother with the process of certificate revocation and CRL issuance. Now
as a result of OpenSSL's imlementation, none of my clients who use
OpenSSL will be able to deal with me online. Because my certificates do
not have a CRL and CRLDP period. Should I stop doing business
altogether? Should I contact my business partners and tell them that
they should be applying a patch to their code, overriding verification
failure in their certVerifyCallbacks? Let's just think that through a
little.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org