ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/crypto/openssl/crypto/asn1/d2i_pr.c
(Generate patch)

Comparing trunk/crypto/openssl/crypto/asn1/d2i_pr.c (file contents):
Revision 11619 by laffer1, Sun Jul 8 16:21:23 2018 UTC vs.
Revision 11620 by laffer1, Sun Jul 8 16:40:18 2018 UTC

# Line 72 | Line 72 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const
72                           long length)
73   {
74      EVP_PKEY *ret;
75 +    const unsigned char *p = *pp;
76  
77      if ((a == NULL) || (*a == NULL)) {
78          if ((ret = EVP_PKEY_new()) == NULL) {
# Line 94 | Line 95 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const
95      }
96  
97      if (!ret->ameth->old_priv_decode ||
98 <        !ret->ameth->old_priv_decode(ret, pp, length)) {
98 >        !ret->ameth->old_priv_decode(ret, &p, length)) {
99          if (ret->ameth->priv_decode) {
100              EVP_PKEY *tmp;
101              PKCS8_PRIV_KEY_INFO *p8 = NULL;
102 <            p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, pp, length);
102 >            p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
103              if (!p8)
104                  goto err;
105              tmp = EVP_PKCS82PKEY(p8);
# Line 112 | Line 113 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const
113              goto err;
114          }
115      }
116 +    *pp = p;
117      if (a != NULL)
118          (*a) = ret;
119      return (ret);
# Line 139 | Line 141 | EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsig
141       * input is surrounded by an ASN1 SEQUENCE.
142       */
143      inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
144 +    p = *pp;
145      /*
146       * Since we only need to discern "traditional format" RSA and DSA keys we
147       * can just count the elements.
# Line 149 | Line 152 | EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsig
152          keytype = EVP_PKEY_EC;
153      else if (sk_ASN1_TYPE_num(inkey) == 3) { /* This seems to be PKCS8, not
154                                                * traditional format */
155 <        PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, pp, length);
155 >        PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
156          EVP_PKEY *ret;
157  
158          sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
# Line 160 | Line 163 | EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsig
163          }
164          ret = EVP_PKCS82PKEY(p8);
165          PKCS8_PRIV_KEY_INFO_free(p8);
166 +        if (ret == NULL)
167 +            return NULL;
168 +        *pp = p;
169          if (a) {
170              *a = ret;
171          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines