diff options
Diffstat (limited to 'src/lib/libcrypto/camellia/cmll_ofb.c')
-rw-r--r-- | src/lib/libcrypto/camellia/cmll_ofb.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/lib/libcrypto/camellia/cmll_ofb.c b/src/lib/libcrypto/camellia/cmll_ofb.c index d89cf9f3b3..a482befc74 100644 --- a/src/lib/libcrypto/camellia/cmll_ofb.c +++ b/src/lib/libcrypto/camellia/cmll_ofb.c | |||
@@ -105,37 +105,15 @@ | |||
105 | * [including the GNU Public Licence.] | 105 | * [including the GNU Public Licence.] |
106 | */ | 106 | */ |
107 | 107 | ||
108 | #ifndef CAMELLIA_DEBUG | ||
109 | # ifndef NDEBUG | ||
110 | # define NDEBUG | ||
111 | # endif | ||
112 | #endif | ||
113 | #include <assert.h> | ||
114 | #include <openssl/camellia.h> | 108 | #include <openssl/camellia.h> |
115 | #include "cmll_locl.h" | 109 | #include <openssl/modes.h> |
116 | 110 | ||
117 | /* The input and output encrypted as though 128bit ofb mode is being | 111 | /* The input and output encrypted as though 128bit ofb mode is being |
118 | * used. The extra state information to record how much of the | 112 | * used. The extra state information to record how much of the |
119 | * 128bit block we have used is contained in *num; | 113 | * 128bit block we have used is contained in *num; |
120 | */ | 114 | */ |
121 | void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 115 | void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
122 | const unsigned long length, const CAMELLIA_KEY *key, | 116 | size_t length, const CAMELLIA_KEY *key, |
123 | unsigned char *ivec, int *num) { | 117 | unsigned char *ivec, int *num) { |
124 | 118 | CRYPTO_ofb128_encrypt(in,out,length,key,ivec,num,(block128_f)Camellia_encrypt); | |
125 | unsigned int n; | ||
126 | unsigned long l=length; | ||
127 | |||
128 | assert(in && out && key && ivec && num); | ||
129 | |||
130 | n = *num; | ||
131 | |||
132 | while (l--) { | ||
133 | if (n == 0) { | ||
134 | Camellia_encrypt(ivec, ivec, key); | ||
135 | } | ||
136 | *(out++) = *(in++) ^ ivec[n]; | ||
137 | n = (n+1) % CAMELLIA_BLOCK_SIZE; | ||
138 | } | ||
139 | |||
140 | *num=n; | ||
141 | } | 119 | } |