#include <openssl/err.h>
#include <string.h>
+#include "gost_lcl.h"
#include "e_gost_err.h"
enum GRASSHOPPER_CIPHER_TYPE {
return 1;
}
-/* increment counter (128-bit int) by 1 */
-static void ctr128_inc(unsigned char *counter)
+void inc_counter(unsigned char* counter, size_t counter_bytes)
{
- unsigned int n = 16;
unsigned char c;
+ unsigned int n = counter_bytes;
do {
--n;
} while (n);
}
+/* increment counter (128-bit int) by 1 */
+static void ctr128_inc(unsigned char *counter)
+{
+ inc_counter(counter, 16);
+}
+
int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
const unsigned char* in, size_t inl) {
gost_grasshopper_cipher_ctx_ctr* c = (gost_grasshopper_cipher_ctx_ctr*) EVP_CIPHER_CTX_get_cipher_data(ctx);