diff options
author | markus <> | 2002-09-05 12:51:50 +0000 |
---|---|---|
committer | markus <> | 2002-09-05 12:51:50 +0000 |
commit | 15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch) | |
tree | bf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/asn1/x_pkey.c | |
parent | 027351f729b9e837200dae6e1520cda6577ab930 (diff) | |
download | openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2 openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip |
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/asn1/x_pkey.c')
-rw-r--r-- | src/lib/libcrypto/asn1/x_pkey.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c index 1d4d926129..f1c6221ac3 100644 --- a/src/lib/libcrypto/asn1/x_pkey.c +++ b/src/lib/libcrypto/asn1/x_pkey.c | |||
@@ -58,25 +58,18 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "evp.h" | 61 | #include <openssl/evp.h> |
62 | #include "objects.h" | 62 | #include <openssl/objects.h> |
63 | #include "asn1_mac.h" | 63 | #include <openssl/asn1_mac.h> |
64 | 64 | #include <openssl/x509.h> | |
65 | /* ASN1err(ASN1_F_D2I_X509_PKEY,ASN1_R_UNSUPPORTED_CIPHER); */ | ||
66 | /* ASN1err(ASN1_F_X509_PKEY_NEW,ASN1_R_IV_TOO_LARGE); */ | ||
67 | 65 | ||
68 | /* need to implement */ | 66 | /* need to implement */ |
69 | int i2d_X509_PKEY(a,pp) | 67 | int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp) |
70 | X509_PKEY *a; | ||
71 | unsigned char **pp; | ||
72 | { | 68 | { |
73 | return(0); | 69 | return(0); |
74 | } | 70 | } |
75 | 71 | ||
76 | X509_PKEY *d2i_X509_PKEY(a,pp,length) | 72 | X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, unsigned char **pp, long length) |
77 | X509_PKEY **a; | ||
78 | unsigned char **pp; | ||
79 | long length; | ||
80 | { | 73 | { |
81 | int i; | 74 | int i; |
82 | M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); | 75 | M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); |
@@ -91,6 +84,7 @@ long length; | |||
91 | if (ret->cipher.cipher == NULL) | 84 | if (ret->cipher.cipher == NULL) |
92 | { | 85 | { |
93 | c.error=ASN1_R_UNSUPPORTED_CIPHER; | 86 | c.error=ASN1_R_UNSUPPORTED_CIPHER; |
87 | c.line=__LINE__; | ||
94 | goto err; | 88 | goto err; |
95 | } | 89 | } |
96 | if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING) | 90 | if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING) |
@@ -99,6 +93,7 @@ long length; | |||
99 | if (i > EVP_MAX_IV_LENGTH) | 93 | if (i > EVP_MAX_IV_LENGTH) |
100 | { | 94 | { |
101 | c.error=ASN1_R_IV_TOO_LARGE; | 95 | c.error=ASN1_R_IV_TOO_LARGE; |
96 | c.line=__LINE__; | ||
102 | goto err; | 97 | goto err; |
103 | } | 98 | } |
104 | memcpy(ret->cipher.iv, | 99 | memcpy(ret->cipher.iv, |
@@ -109,14 +104,15 @@ long length; | |||
109 | M_ASN1_D2I_Finish(a,X509_PKEY_free,ASN1_F_D2I_X509_PKEY); | 104 | M_ASN1_D2I_Finish(a,X509_PKEY_free,ASN1_F_D2I_X509_PKEY); |
110 | } | 105 | } |
111 | 106 | ||
112 | X509_PKEY *X509_PKEY_new() | 107 | X509_PKEY *X509_PKEY_new(void) |
113 | { | 108 | { |
114 | X509_PKEY *ret=NULL; | 109 | X509_PKEY *ret=NULL; |
110 | ASN1_CTX c; | ||
115 | 111 | ||
116 | M_ASN1_New_Malloc(ret,X509_PKEY); | 112 | M_ASN1_New_Malloc(ret,X509_PKEY); |
117 | ret->version=0; | 113 | ret->version=0; |
118 | M_ASN1_New(ret->enc_algor,X509_ALGOR_new); | 114 | M_ASN1_New(ret->enc_algor,X509_ALGOR_new); |
119 | M_ASN1_New(ret->enc_pkey,ASN1_OCTET_STRING_new); | 115 | M_ASN1_New(ret->enc_pkey,M_ASN1_OCTET_STRING_new); |
120 | ret->dec_pkey=NULL; | 116 | ret->dec_pkey=NULL; |
121 | ret->key_length=0; | 117 | ret->key_length=0; |
122 | ret->key_data=NULL; | 118 | ret->key_data=NULL; |
@@ -128,8 +124,7 @@ X509_PKEY *X509_PKEY_new() | |||
128 | M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW); | 124 | M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW); |
129 | } | 125 | } |
130 | 126 | ||
131 | void X509_PKEY_free(x) | 127 | void X509_PKEY_free(X509_PKEY *x) |
132 | X509_PKEY *x; | ||
133 | { | 128 | { |
134 | int i; | 129 | int i; |
135 | 130 | ||
@@ -149,8 +144,8 @@ X509_PKEY *x; | |||
149 | #endif | 144 | #endif |
150 | 145 | ||
151 | if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); | 146 | if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); |
152 | if (x->enc_pkey != NULL) ASN1_OCTET_STRING_free(x->enc_pkey); | 147 | if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey); |
153 | if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey); | 148 | if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey); |
154 | if ((x->key_data != NULL) && (x->key_free)) Free((char *)x->key_data); | 149 | if ((x->key_data != NULL) && (x->key_free)) OPENSSL_free(x->key_data); |
155 | Free((char *)(char *)x); | 150 | OPENSSL_free(x); |
156 | } | 151 | } |