diff options
Diffstat (limited to 'src/lib/libcrypto/seed/seed_cfb.c')
| -rw-r--r-- | src/lib/libcrypto/seed/seed_cfb.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/lib/libcrypto/seed/seed_cfb.c b/src/lib/libcrypto/seed/seed_cfb.c index 07d878a788..694597dd06 100644 --- a/src/lib/libcrypto/seed/seed_cfb.c +++ b/src/lib/libcrypto/seed/seed_cfb.c | |||
| @@ -105,40 +105,12 @@ | |||
| 105 | * [including the GNU Public Licence.] | 105 | * [including the GNU Public Licence.] |
| 106 | */ | 106 | */ |
| 107 | 107 | ||
| 108 | #include "seed_locl.h" | 108 | #include <openssl/seed.h> |
| 109 | #include <string.h> | 109 | #include <openssl/modes.h> |
| 110 | 110 | ||
| 111 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 111 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
| 112 | size_t len, const SEED_KEY_SCHEDULE *ks, | 112 | size_t len, const SEED_KEY_SCHEDULE *ks, |
| 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc) | 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc) |
| 114 | { | 114 | { |
| 115 | int n; | 115 | CRYPTO_cfb128_encrypt(in,out,len,ks,ivec,num,enc,(block128_f)SEED_encrypt); |
| 116 | unsigned char c; | ||
| 117 | |||
| 118 | n = *num; | ||
| 119 | |||
| 120 | if (enc) | ||
| 121 | { | ||
| 122 | while (len--) | ||
| 123 | { | ||
| 124 | if (n == 0) | ||
| 125 | SEED_encrypt(ivec, ivec, ks); | ||
| 126 | ivec[n] = *(out++) = *(in++) ^ ivec[n]; | ||
| 127 | n = (n+1) % SEED_BLOCK_SIZE; | ||
| 128 | } | ||
| 129 | } | ||
| 130 | else | ||
| 131 | { | ||
| 132 | while (len--) | ||
| 133 | { | ||
| 134 | if (n == 0) | ||
| 135 | SEED_encrypt(ivec, ivec, ks); | ||
| 136 | c = *(in); | ||
| 137 | *(out++) = *(in++) ^ ivec[n]; | ||
| 138 | ivec[n] = c; | ||
| 139 | n = (n+1) % SEED_BLOCK_SIZE; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | *num = n; | ||
| 144 | } | 116 | } |
