Check for FindNextFile when defining it rather than FindFirstFile
[oweals/openssl.git] / crypto / asn1 / d2i_pu.c
index d2567d1737cda3fb38f400f8b0d0363ba5bb8022..c8f39ceb037beb1fef1cc42ed839a53fc7847871 100644 (file)
@@ -73,7 +73,7 @@
 #endif
 
 EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
-                       size_t length)
+            long length)
        {
        EVP_PKEY *ret;
 
@@ -87,9 +87,13 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
                }
        else    ret= *a;
 
-       ret->save_type=type;
-       ret->type=EVP_PKEY_type(type);
-       switch (ret->type)
+       if (!EVP_PKEY_set_type(ret, type))
+               {
+               ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);
+               goto err;
+               }
+
+       switch (EVP_PKEY_id(ret))
                {
 #ifndef OPENSSL_NO_RSA
        case EVP_PKEY_RSA: