summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_ofb_d.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/e_ofb_d.c')
-rw-r--r--src/lib/libcrypto/evp/e_ofb_d.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/lib/libcrypto/evp/e_ofb_d.c b/src/lib/libcrypto/evp/e_ofb_d.c
index 09d4b4139d..398b3a002e 100644
--- a/src/lib/libcrypto/evp/e_ofb_d.c
+++ b/src/lib/libcrypto/evp/e_ofb_d.c
@@ -56,21 +56,16 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DES
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "evp.h" 62#include <openssl/evp.h>
62#include "objects.h" 63#include <openssl/objects.h>
63 64
64#ifndef NOPROTO
65static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, 65static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
66 unsigned char *iv,int enc); 66 unsigned char *iv,int enc);
67static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 67static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
68 unsigned char *in, unsigned int inl); 68 unsigned char *in, unsigned int inl);
69#else
70static void des_ofb_init_key();
71static void des_ofb_cipher();
72#endif
73
74static EVP_CIPHER d_ofb_cipher= 69static EVP_CIPHER d_ofb_cipher=
75 { 70 {
76 NID_des_ofb64, 71 NID_des_ofb64,
@@ -84,35 +79,29 @@ static EVP_CIPHER d_ofb_cipher=
84 EVP_CIPHER_get_asn1_iv, 79 EVP_CIPHER_get_asn1_iv,
85 }; 80 };
86 81
87EVP_CIPHER *EVP_des_ofb() 82EVP_CIPHER *EVP_des_ofb(void)
88 { 83 {
89 return(&d_ofb_cipher); 84 return(&d_ofb_cipher);
90 } 85 }
91 86
92static void des_ofb_init_key(ctx,key,iv,enc) 87static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
93EVP_CIPHER_CTX *ctx; 88 unsigned char *iv, int enc)
94unsigned char *key;
95unsigned char *iv;
96int enc;
97 { 89 {
90 des_cblock *deskey = (des_cblock *)key;
91
98 ctx->num=0; 92 ctx->num=0;
99 93
100 if (iv != NULL) 94 if (iv != NULL)
101 memcpy(&(ctx->oiv[0]),iv,8); 95 memcpy(&(ctx->oiv[0]),iv,8);
102 memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); 96 memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
103 if (key != NULL) 97 if (deskey != NULL)
104 des_set_key((des_cblock *)key,ctx->c.des_ks); 98 des_set_key(deskey,ctx->c.des_ks);
105 } 99 }
106 100
107static void des_ofb_cipher(ctx,out,in,inl) 101static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
108EVP_CIPHER_CTX *ctx; 102 unsigned char *in, unsigned int inl)
109unsigned char *out;
110unsigned char *in;
111unsigned int inl;
112 { 103 {
113 des_ofb64_encrypt( 104 des_ofb64_encrypt(in,out,inl,ctx->c.des_ks,
114 in,out, 105 (des_cblock *)&(ctx->iv[0]),&ctx->num);
115 (long)inl, ctx->c.des_ks,
116 (des_cblock *)&(ctx->iv[0]),
117 &ctx->num);
118 } 106 }
107#endif