OLD | NEW |
1 /* crypto/evp/p_seal.c */ | 1 /* crypto/evp/p_seal.c */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return 1; | 80 return 1; |
81 if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) | 81 if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) |
82 return 0; | 82 return 0; |
83 if (EVP_CIPHER_CTX_iv_length(ctx)) | 83 if (EVP_CIPHER_CTX_iv_length(ctx)) |
84 RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx)); | 84 RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx)); |
85 | 85 |
86 if(!EVP_EncryptInit_ex(ctx,NULL,NULL,key,iv)) return 0; | 86 if(!EVP_EncryptInit_ex(ctx,NULL,NULL,key,iv)) return 0; |
87 | 87 |
88 for (i=0; i<npubk; i++) | 88 for (i=0; i<npubk; i++) |
89 { | 89 { |
90 » » ekl[i]=EVP_PKEY_encrypt(ek[i],key,EVP_CIPHER_CTX_key_length(ctx)
, | 90 » » ekl[i]=EVP_PKEY_encrypt_old(ek[i],key,EVP_CIPHER_CTX_key_length(
ctx), |
91 pubk[i]); | 91 pubk[i]); |
92 if (ekl[i] <= 0) return(-1); | 92 if (ekl[i] <= 0) return(-1); |
93 } | 93 } |
94 return(npubk); | 94 return(npubk); |
95 } | 95 } |
96 | 96 |
97 /* MACRO | 97 /* MACRO |
98 void EVP_SealUpdate(ctx,out,outl,in,inl) | 98 void EVP_SealUpdate(ctx,out,outl,in,inl) |
99 EVP_CIPHER_CTX *ctx; | 99 EVP_CIPHER_CTX *ctx; |
100 unsigned char *out; | 100 unsigned char *out; |
101 int *outl; | 101 int *outl; |
102 unsigned char *in; | 102 unsigned char *in; |
103 int inl; | 103 int inl; |
104 { | 104 { |
105 EVP_EncryptUpdate(ctx,out,outl,in,inl); | 105 EVP_EncryptUpdate(ctx,out,outl,in,inl); |
106 } | 106 } |
107 */ | 107 */ |
108 | 108 |
109 int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 109 int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
110 { | 110 { |
111 int i; | 111 int i; |
112 i = EVP_EncryptFinal_ex(ctx,out,outl); | 112 i = EVP_EncryptFinal_ex(ctx,out,outl); |
113 EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); | 113 EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); |
114 return i; | 114 return i; |
115 } | 115 } |
OLD | NEW |