diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/x_pkey.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/x_pkey.c | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c index d454afb72b..9523740af7 100644 --- a/src/lib/libcrypto/asn1/x_pkey.c +++ b/src/lib/libcrypto/asn1/x_pkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_pkey.c,v 1.15 2014/07/12 16:03:36 miod Exp $ */ | 1 | /* $OpenBSD: x_pkey.c,v 1.16 2015/04/12 15:15:51 doug Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -65,46 +65,6 @@ | |||
| 65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 66 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 67 | 67 | ||
| 68 | /* need to implement */ | ||
| 69 | int | ||
| 70 | i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp) | ||
| 71 | { | ||
| 72 | return (0); | ||
| 73 | } | ||
| 74 | |||
| 75 | X509_PKEY * | ||
| 76 | d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length) | ||
| 77 | { | ||
| 78 | int i; | ||
| 79 | M_ASN1_D2I_vars(a, X509_PKEY *, X509_PKEY_new); | ||
| 80 | |||
| 81 | M_ASN1_D2I_Init(); | ||
| 82 | M_ASN1_D2I_start_sequence(); | ||
| 83 | M_ASN1_D2I_get_x(X509_ALGOR, ret->enc_algor, d2i_X509_ALGOR); | ||
| 84 | M_ASN1_D2I_get_x(ASN1_OCTET_STRING, ret->enc_pkey, | ||
| 85 | d2i_ASN1_OCTET_STRING); | ||
| 86 | |||
| 87 | ret->cipher.cipher = EVP_get_cipherbyname( | ||
| 88 | OBJ_nid2ln(OBJ_obj2nid(ret->enc_algor->algorithm))); | ||
| 89 | if (ret->cipher.cipher == NULL) { | ||
| 90 | c.error = ASN1_R_UNSUPPORTED_CIPHER; | ||
| 91 | c.line = __LINE__; | ||
| 92 | goto err; | ||
| 93 | } | ||
| 94 | if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING) { | ||
| 95 | i = ret->enc_algor->parameter->value.octet_string->length; | ||
| 96 | if (i > EVP_MAX_IV_LENGTH) { | ||
| 97 | c.error = ASN1_R_IV_TOO_LARGE; | ||
| 98 | c.line = __LINE__; | ||
| 99 | goto err; | ||
| 100 | } | ||
| 101 | memcpy(ret->cipher.iv, | ||
| 102 | ret->enc_algor->parameter->value.octet_string->data, i); | ||
| 103 | } else | ||
| 104 | memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); | ||
| 105 | M_ASN1_D2I_Finish(a, X509_PKEY_free, ASN1_F_D2I_X509_PKEY); | ||
| 106 | } | ||
| 107 | |||
| 108 | X509_PKEY * | 68 | X509_PKEY * |
| 109 | X509_PKEY_new(void) | 69 | X509_PKEY_new(void) |
| 110 | { | 70 | { |
