summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/p5_pbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/p5_pbe.c')
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index b7ed538eb2..891150638e 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -58,53 +58,18 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63#include <openssl/rand.h> 63#include <openssl/rand.h>
64 64
65/* PKCS#5 password based encryption structure */ 65/* PKCS#5 password based encryption structure */
66 66
67int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp) 67ASN1_SEQUENCE(PBEPARAM) = {
68{ 68 ASN1_SIMPLE(PBEPARAM, salt, ASN1_OCTET_STRING),
69 M_ASN1_I2D_vars(a); 69 ASN1_SIMPLE(PBEPARAM, iter, ASN1_INTEGER)
70 M_ASN1_I2D_len (a->salt, i2d_ASN1_OCTET_STRING); 70} ASN1_SEQUENCE_END(PBEPARAM)
71 M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);
72
73 M_ASN1_I2D_seq_total ();
74
75 M_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING);
76 M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER);
77 M_ASN1_I2D_finish();
78}
79
80PBEPARAM *PBEPARAM_new(void)
81{
82 PBEPARAM *ret=NULL;
83 ASN1_CTX c;
84 M_ASN1_New_Malloc(ret, PBEPARAM);
85 M_ASN1_New(ret->iter,M_ASN1_INTEGER_new);
86 M_ASN1_New(ret->salt,M_ASN1_OCTET_STRING_new);
87 return (ret);
88 M_ASN1_New_Error(ASN1_F_PBEPARAM_NEW);
89}
90
91PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, unsigned char **pp, long length)
92{
93 M_ASN1_D2I_vars(a,PBEPARAM *,PBEPARAM_new);
94 M_ASN1_D2I_Init();
95 M_ASN1_D2I_start_sequence();
96 M_ASN1_D2I_get (ret->salt, d2i_ASN1_OCTET_STRING);
97 M_ASN1_D2I_get (ret->iter, d2i_ASN1_INTEGER);
98 M_ASN1_D2I_Finish(a, PBEPARAM_free, ASN1_F_D2I_PBEPARAM);
99}
100 71
101void PBEPARAM_free (PBEPARAM *a) 72IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM)
102{
103 if(a==NULL) return;
104 M_ASN1_OCTET_STRING_free(a->salt);
105 M_ASN1_INTEGER_free (a->iter);
106 OPENSSL_free (a);
107}
108 73
109/* Return an algorithm identifier for a PKCS#5 PBE algorithm */ 74/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
110 75