Skip to content

Commit a72a02c

Browse files
committed
Build with -Werror
1 parent 3a01994 commit a72a02c

8 files changed

+76
-74
lines changed

gost_ameth.c

+13-11
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Pack bignum into byte buffer of given size, filling all leading bytes by
2424
* zeros
2525
*/
26-
int store_bignum(BIGNUM *bn, unsigned char *buf, int len)
26+
int store_bignum(const BIGNUM *bn, unsigned char *buf, int len)
2727
{
2828
int bytes = BN_num_bytes(bn);
2929

@@ -129,9 +129,9 @@ static int gost_decode_nid_params(EVP_PKEY *pkey, int pkey_nid, int param_nid)
129129
* Parses GOST algorithm parameters from X509_ALGOR and modifies pkey setting
130130
* NID and parameters
131131
*/
132-
static int decode_gost_algor_params(EVP_PKEY *pkey, X509_ALGOR *palg)
132+
static int decode_gost_algor_params(EVP_PKEY *pkey, const X509_ALGOR *palg)
133133
{
134-
ASN1_OBJECT *palg_obj = NULL;
134+
const ASN1_OBJECT *palg_obj = NULL;
135135
int ptype = V_ASN1_UNDEF;
136136
int pkey_nid = NID_undef, param_nid = NID_undef;
137137
ASN1_STRING *pval = NULL;
@@ -140,7 +140,7 @@ static int decode_gost_algor_params(EVP_PKEY *pkey, X509_ALGOR *palg)
140140

141141
if (!pkey || !palg)
142142
return 0;
143-
X509_ALGOR_get0(&palg_obj, &ptype, (void **)&pval, palg);
143+
X509_ALGOR_get0(&palg_obj, &ptype, (const void **)&pval, palg);
144144
if (ptype != V_ASN1_SEQUENCE) {
145145
GOSTerr(GOST_F_DECODE_GOST_ALGOR_PARAMS,
146146
GOST_R_BAD_KEY_PARAMETERS_FORMAT);
@@ -329,14 +329,14 @@ static BIGNUM *unmask_priv_key(EVP_PKEY *pk,
329329
return pknum_masked;
330330
}
331331

332-
static int priv_decode_gost(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf)
332+
static int priv_decode_gost(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf)
333333
{
334334
const unsigned char *pkey_buf = NULL, *p = NULL;
335335
int priv_len = 0;
336336
BIGNUM *pk_num = NULL;
337337
int ret = 0;
338-
X509_ALGOR *palg = NULL;
339-
ASN1_OBJECT *palg_obj = NULL;
338+
const X509_ALGOR *palg = NULL;
339+
const ASN1_OBJECT *palg_obj = NULL;
340340
ASN1_INTEGER *priv_key = NULL;
341341
int expected_key_len = 32;
342342

@@ -742,15 +742,17 @@ static int pub_encode_gost_ec(X509_PUBKEY *pub, const EVP_PKEY *pk)
742742
store_bignum(X, databuf + data_len / 2, data_len / 2);
743743
store_bignum(Y, databuf, data_len / 2);
744744

745+
BUF_reverse(NULL, databuf, data_len);
746+
745747
octet = ASN1_OCTET_STRING_new();
746748
if (octet == NULL) {
747749
GOSTerr(GOST_F_PUB_ENCODE_GOST_EC, ERR_R_MALLOC_FAILURE);
748750
goto err;
749751
}
750-
ASN1_STRING_set(octet, NULL, data_len);
751-
sptr = ASN1_STRING_data(octet);
752-
for (i = 0, j = data_len - 1; i < data_len; i++, j--) {
753-
sptr[i] = databuf[j];
752+
753+
if (0 == ASN1_STRING_set(octet, databuf, data_len)) {
754+
GOSTerr(GOST_F_PUB_ENCODE_GOST_EC, ERR_R_MALLOC_FAILURE);
755+
goto err;
754756
}
755757

756758
ret = i2d_ASN1_OCTET_STRING(octet, &buf);

gost_ec_sign.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ DSA_SIG *gost_ec_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey)
161161
BIGNUM *r = NULL, *s = NULL, *X = NULL, *tmp = NULL, *tmp2 = NULL,
162162
*k = NULL, *e = NULL;
163163

164-
BIGNUM *new_r = NULL, *new_s = NULL;
164+
const BIGNUM *new_r = NULL, *new_s = NULL;
165165

166166
EC_POINT *C = NULL;
167167
BN_CTX *ctx;
@@ -276,7 +276,7 @@ DSA_SIG *gost_ec_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey)
276276
}
277277
while (BN_is_zero(s));
278278

279-
DSA_SIG_get0(&new_r, &new_s, newsig);
279+
DSA_SIG_get0(newsig, &new_r, &new_s);
280280
new_s = BN_dup(s);
281281
new_r = BN_dup(r);
282282
if (!new_s || !new_r) {
@@ -310,7 +310,7 @@ int gost_ec_verify(const unsigned char *dgst, int dgst_len,
310310
BIGNUM *order;
311311
BIGNUM *md = NULL, *e = NULL, *R = NULL, *v = NULL,
312312
*z1 = NULL, *z2 = NULL;
313-
BIGNUM *sig_s = NULL, *sig_r = NULL;
313+
const BIGNUM *sig_s = NULL, *sig_r = NULL;
314314
BIGNUM *X = NULL, *tmp = NULL;
315315
EC_POINT *C = NULL;
316316
const EC_POINT *pub_key = NULL;
@@ -343,7 +343,7 @@ int gost_ec_verify(const unsigned char *dgst, int dgst_len,
343343
goto err;
344344
}
345345

346-
DSA_SIG_get0(&sig_r, &sig_s, sig);
346+
DSA_SIG_get0(sig, &sig_r, &sig_s);
347347

348348
if (BN_is_zero(sig_s) || BN_is_zero(sig_r) ||
349349
(BN_cmp(sig_s, order) >= 1) || (BN_cmp(sig_r, order) >= 1)) {

gost_grasshopper_cipher.c

+20-20
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static struct GRASSHOPPER_CIPHER_PARAMS gost_cipher_params[5] = {
103103
};
104104

105105
/* Set 256 bit key into context */
106-
static GRASSHOPPER_INLINE void gost_grasshopper_cipher_key(gost_grasshopper_cipher_ctx* c, const uint8_t* k) {
106+
GRASSHOPPER_INLINE void gost_grasshopper_cipher_key(gost_grasshopper_cipher_ctx* c, const uint8_t* k) {
107107
int i;
108108
for (i = 0; i < 2; i++) {
109109
grasshopper_copy128(&c->key.k.k[i], (const grasshopper_w128_t*) (k + i * 16));
@@ -113,7 +113,7 @@ static GRASSHOPPER_INLINE void gost_grasshopper_cipher_key(gost_grasshopper_ciph
113113
}
114114

115115
/* Cleans up key from context */
116-
static GRASSHOPPER_INLINE void gost_grasshopper_cipher_destroy(gost_grasshopper_cipher_ctx* c) {
116+
GRASSHOPPER_INLINE void gost_grasshopper_cipher_destroy(gost_grasshopper_cipher_ctx* c) {
117117
int i;
118118
for (i = 0; i < 2; i++) {
119119
grasshopper_zero128(&c->key.k.k[i]);
@@ -142,7 +142,7 @@ static GRASSHOPPER_INLINE void gost_grasshopper_cipher_destroy_ctr(gost_grasshop
142142
ctx->counter = 0;
143143
}
144144

145-
static int gost_grasshopper_cipher_init(EVP_CIPHER_CTX* ctx, const unsigned char* key,
145+
int gost_grasshopper_cipher_init(EVP_CIPHER_CTX* ctx, const unsigned char* key,
146146
const unsigned char* iv, int enc) {
147147
gost_grasshopper_cipher_ctx* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
148148

@@ -168,23 +168,23 @@ static int gost_grasshopper_cipher_init(EVP_CIPHER_CTX* ctx, const unsigned char
168168
return 1;
169169
}
170170

171-
static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ecb(EVP_CIPHER_CTX* ctx, const unsigned char* key,
171+
GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ecb(EVP_CIPHER_CTX* ctx, const unsigned char* key,
172172
const unsigned char* iv,
173173
int enc) {
174174
gost_grasshopper_cipher_ctx* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
175175
c->type = GRASSHOPPER_CIPHER_ECB;
176176
return gost_grasshopper_cipher_init(ctx, key, iv, enc);
177177
}
178178

179-
static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_cbc(EVP_CIPHER_CTX* ctx, const unsigned char* key,
179+
GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_cbc(EVP_CIPHER_CTX* ctx, const unsigned char* key,
180180
const unsigned char* iv,
181181
int enc) {
182182
gost_grasshopper_cipher_ctx* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
183183
c->type = GRASSHOPPER_CIPHER_CBC;
184184
return gost_grasshopper_cipher_init(ctx, key, iv, enc);
185185
}
186186

187-
static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ofb(EVP_CIPHER_CTX* ctx, const unsigned char* key,
187+
GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ofb(EVP_CIPHER_CTX* ctx, const unsigned char* key,
188188
const unsigned char* iv,
189189
int enc) {
190190
gost_grasshopper_cipher_ctx_ofb* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
@@ -196,15 +196,15 @@ static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ofb(EVP_CIPHER_CTX* c
196196
return gost_grasshopper_cipher_init(ctx, key, iv, enc);
197197
}
198198

199-
static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_cfb(EVP_CIPHER_CTX* ctx, const unsigned char* key,
199+
GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_cfb(EVP_CIPHER_CTX* ctx, const unsigned char* key,
200200
const unsigned char* iv,
201201
int enc) {
202202
gost_grasshopper_cipher_ctx* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
203203
c->type = GRASSHOPPER_CIPHER_CFB;
204204
return gost_grasshopper_cipher_init(ctx, key, iv, enc);
205205
}
206206

207-
static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ctr(EVP_CIPHER_CTX* ctx, const unsigned char* key,
207+
GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ctr(EVP_CIPHER_CTX* ctx, const unsigned char* key,
208208
const unsigned char* iv,
209209
int enc) {
210210
gost_grasshopper_cipher_ctx_ctr* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
@@ -219,15 +219,15 @@ static GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ctr(EVP_CIPHER_CTX* c
219219
return gost_grasshopper_cipher_init(ctx, key, iv, enc);
220220
}
221221

222-
static GRASSHOPPER_INLINE int gost_grasshopper_cipher_do(EVP_CIPHER_CTX* ctx, unsigned char* out,
222+
GRASSHOPPER_INLINE int gost_grasshopper_cipher_do(EVP_CIPHER_CTX* ctx, unsigned char* out,
223223
const unsigned char* in, size_t inl) {
224224
gost_grasshopper_cipher_ctx* c = (gost_grasshopper_cipher_ctx*) EVP_CIPHER_CTX_get_cipher_data(ctx);
225225
struct GRASSHOPPER_CIPHER_PARAMS* params = &gost_cipher_params[c->type];
226226

227227
return params->do_cipher(ctx, out, in, inl);
228228
}
229229

230-
static int gost_grasshopper_cipher_do_ecb(EVP_CIPHER_CTX* ctx, unsigned char* out,
230+
int gost_grasshopper_cipher_do_ecb(EVP_CIPHER_CTX* ctx, unsigned char* out,
231231
const unsigned char* in, size_t inl) {
232232
gost_grasshopper_cipher_ctx* c = (gost_grasshopper_cipher_ctx*) EVP_CIPHER_CTX_get_cipher_data(ctx);
233233
bool encrypting = (bool) EVP_CIPHER_CTX_encrypting(ctx);
@@ -251,7 +251,7 @@ static int gost_grasshopper_cipher_do_ecb(EVP_CIPHER_CTX* ctx, unsigned char* ou
251251
return 1;
252252
}
253253

254-
static int gost_grasshopper_cipher_do_cbc(EVP_CIPHER_CTX* ctx, unsigned char* out,
254+
int gost_grasshopper_cipher_do_cbc(EVP_CIPHER_CTX* ctx, unsigned char* out,
255255
const unsigned char* in, size_t inl) {
256256
gost_grasshopper_cipher_ctx* c = (gost_grasshopper_cipher_ctx*) EVP_CIPHER_CTX_get_cipher_data(ctx);
257257
unsigned char* iv = EVP_CIPHER_CTX_iv_noconst(ctx);
@@ -283,7 +283,7 @@ static int gost_grasshopper_cipher_do_cbc(EVP_CIPHER_CTX* ctx, unsigned char* ou
283283
return 1;
284284
}
285285

286-
static int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
286+
int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
287287
const unsigned char* in, size_t inl) {
288288
gost_grasshopper_cipher_ctx_ctr* c = (gost_grasshopper_cipher_ctx_ctr*) EVP_CIPHER_CTX_get_cipher_data(ctx);
289289
unsigned char* iv = EVP_CIPHER_CTX_iv_noconst(ctx);
@@ -372,7 +372,7 @@ static void gost_grasshopper_cnt_next(gost_grasshopper_cipher_ctx_ofb* ctx, gras
372372
grasshopper_encrypt_block(&ctx->c.encrypt_round_keys, &ctx->buffer1, buf, &ctx->c.buffer);
373373
}
374374

375-
static int gost_grasshopper_cipher_do_ofb(EVP_CIPHER_CTX* ctx, unsigned char* out,
375+
int gost_grasshopper_cipher_do_ofb(EVP_CIPHER_CTX* ctx, unsigned char* out,
376376
const unsigned char* in, size_t inl) {
377377
gost_grasshopper_cipher_ctx_ofb* c = (gost_grasshopper_cipher_ctx_ofb*) EVP_CIPHER_CTX_get_cipher_data(ctx);
378378
const unsigned char* in_ptr = in;
@@ -430,7 +430,7 @@ static int gost_grasshopper_cipher_do_ofb(EVP_CIPHER_CTX* ctx, unsigned char* ou
430430
return 1;
431431
}
432432

433-
static int gost_grasshopper_cipher_do_cfb(EVP_CIPHER_CTX* ctx, unsigned char* out,
433+
int gost_grasshopper_cipher_do_cfb(EVP_CIPHER_CTX* ctx, unsigned char* out,
434434
const unsigned char* in, size_t inl) {
435435
gost_grasshopper_cipher_ctx* c = (gost_grasshopper_cipher_ctx*) EVP_CIPHER_CTX_get_cipher_data(ctx);
436436
const unsigned char* in_ptr = in;
@@ -509,7 +509,7 @@ static int gost_grasshopper_cipher_do_cfb(EVP_CIPHER_CTX* ctx, unsigned char* ou
509509
return 1;
510510
}
511511

512-
static int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx) {
512+
int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx) {
513513
gost_grasshopper_cipher_ctx* c = (gost_grasshopper_cipher_ctx*) EVP_CIPHER_CTX_get_cipher_data(ctx);
514514
struct GRASSHOPPER_CIPHER_PARAMS* params = &gost_cipher_params[c->type];
515515

@@ -523,7 +523,7 @@ static int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx) {
523523
return 1;
524524
}
525525

526-
static int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params) {
526+
int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params) {
527527
int len = 0;
528528
unsigned char* buf = NULL;
529529
unsigned char* p = NULL;
@@ -542,7 +542,7 @@ static int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE*
542542
return 1;
543543
}
544544

545-
static GRASSHOPPER_INLINE int gost_grasshopper_get_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params) {
545+
GRASSHOPPER_INLINE int gost_grasshopper_get_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params) {
546546
int ret = -1;
547547

548548
if (ASN1_TYPE_get(params) != V_ASN1_SEQUENCE) {
@@ -552,7 +552,7 @@ static GRASSHOPPER_INLINE int gost_grasshopper_get_asn1_parameters(EVP_CIPHER_CT
552552
return 1;
553553
}
554554

555-
static int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr) {
555+
int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr) {
556556
switch (type) {
557557
case EVP_CTRL_RAND_KEY: {
558558
if (RAND_bytes((unsigned char*) ptr, EVP_CIPHER_CTX_key_length(ctx)) <= 0) {
@@ -568,7 +568,7 @@ static int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX* ctx, int type, int arg, v
568568
return 1;
569569
}
570570

571-
static GRASSHOPPER_INLINE EVP_CIPHER* cipher_gost_grasshopper_create(int cipher_type, int block_size) {
571+
GRASSHOPPER_INLINE EVP_CIPHER* cipher_gost_grasshopper_create(int cipher_type, int block_size) {
572572
return EVP_CIPHER_meth_new(cipher_type,
573573
block_size /* block_size */,
574574
GRASSHOPPER_KEY_SIZE /* key_size */);
@@ -590,7 +590,7 @@ const int cipher_gost_grasshopper_setup(EVP_CIPHER* cipher, uint8_t mode, int iv
590590
EVP_CIPHER_meth_set_do_cipher(cipher, gost_grasshopper_cipher_do);
591591
}
592592

593-
static const GRASSHOPPER_INLINE EVP_CIPHER* cipher_gost_grasshopper(uint8_t mode, uint8_t num) {
593+
const GRASSHOPPER_INLINE EVP_CIPHER* cipher_gost_grasshopper(uint8_t mode, uint8_t num) {
594594
EVP_CIPHER** cipher;
595595
struct GRASSHOPPER_CIPHER_PARAMS* params;
596596

gost_grasshopper_cipher.h

+28-28
Original file line numberDiff line numberDiff line change
@@ -46,54 +46,54 @@ typedef int (* grasshopper_do_cipher_func)(EVP_CIPHER_CTX* ctx, unsigned char* o
4646

4747
typedef void (* grasshopper_destroy_cipher_func)(gost_grasshopper_cipher_ctx* c);
4848

49-
static void gost_grasshopper_cipher_key(gost_grasshopper_cipher_ctx* c, const uint8_t* k);
49+
void gost_grasshopper_cipher_key(gost_grasshopper_cipher_ctx* c, const uint8_t* k);
5050

51-
static void gost_grasshopper_cipher_destroy(gost_grasshopper_cipher_ctx* c);
51+
void gost_grasshopper_cipher_destroy(gost_grasshopper_cipher_ctx* c);
5252

53-
static int gost_grasshopper_cipher_init_ecb(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
53+
int gost_grasshopper_cipher_init_ecb(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
5454

55-
static int gost_grasshopper_cipher_init_cbc(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
55+
int gost_grasshopper_cipher_init_cbc(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
5656

57-
static int gost_grasshopper_cipher_init_ofb(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
57+
int gost_grasshopper_cipher_init_ofb(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
5858

59-
static int gost_grasshopper_cipher_init_cfb(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
59+
int gost_grasshopper_cipher_init_cfb(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
6060

61-
static int gost_grasshopper_cipher_init_ctr(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
61+
int gost_grasshopper_cipher_init_ctr(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv, int enc);
6262

63-
static int gost_grasshopper_cipher_init(EVP_CIPHER_CTX* ctx, const unsigned char* key,
64-
const unsigned char* iv, int enc);
63+
int gost_grasshopper_cipher_init(EVP_CIPHER_CTX* ctx, const unsigned char* key,
64+
const unsigned char* iv, int enc);
6565

66-
static int gost_grasshopper_cipher_do(EVP_CIPHER_CTX* ctx, unsigned char* out,
67-
const unsigned char* in, size_t inl);
66+
int gost_grasshopper_cipher_do(EVP_CIPHER_CTX* ctx, unsigned char* out,
67+
const unsigned char* in, size_t inl);
6868

69-
static int gost_grasshopper_cipher_do_ecb(EVP_CIPHER_CTX* ctx, unsigned char* out,
70-
const unsigned char* in, size_t inl);
69+
int gost_grasshopper_cipher_do_ecb(EVP_CIPHER_CTX* ctx, unsigned char* out,
70+
const unsigned char* in, size_t inl);
7171

72-
static int gost_grasshopper_cipher_do_cbc(EVP_CIPHER_CTX* ctx, unsigned char* out,
73-
const unsigned char* in, size_t inl);
72+
int gost_grasshopper_cipher_do_cbc(EVP_CIPHER_CTX* ctx, unsigned char* out,
73+
const unsigned char* in, size_t inl);
7474

75-
static int gost_grasshopper_cipher_do_ofb(EVP_CIPHER_CTX* ctx, unsigned char* out,
76-
const unsigned char* in, size_t inl);
75+
int gost_grasshopper_cipher_do_ofb(EVP_CIPHER_CTX* ctx, unsigned char* out,
76+
const unsigned char* in, size_t inl);
7777

78-
static int gost_grasshopper_cipher_do_cfb(EVP_CIPHER_CTX* ctx, unsigned char* out,
79-
const unsigned char* in, size_t inl);
78+
int gost_grasshopper_cipher_do_cfb(EVP_CIPHER_CTX* ctx, unsigned char* out,
79+
const unsigned char* in, size_t inl);
8080

81-
static int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
82-
const unsigned char* in, size_t inl);
81+
int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
82+
const unsigned char* in, size_t inl);
8383

84-
static int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx);
84+
int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx);
8585

86-
static int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params);
86+
int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params);
8787

88-
static int gost_grasshopper_get_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params);
88+
int gost_grasshopper_get_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params);
8989

90-
static int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr);
90+
int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr);
9191

92-
static EVP_CIPHER* cipher_gost_grasshopper_create(int cipher_type, int block_size);
92+
EVP_CIPHER* cipher_gost_grasshopper_create(int cipher_type, int block_size);
9393

94-
static const int cipher_gost_grasshopper_setup(EVP_CIPHER* cipher, uint8_t mode, int iv_size, bool padding);
94+
const int cipher_gost_grasshopper_setup(EVP_CIPHER* cipher, uint8_t mode, int iv_size, bool padding);
9595

96-
static const EVP_CIPHER* cipher_gost_grasshopper(uint8_t mode, uint8_t num);
96+
const EVP_CIPHER* cipher_gost_grasshopper(uint8_t mode, uint8_t num);
9797

9898
extern const EVP_CIPHER* cipher_gost_grasshopper_ecb();
9999
extern const EVP_CIPHER* cipher_gost_grasshopper_cbc();

gost_grasshopper_precompiled.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "gost_grasshopper_defines.h"
88
#include "gost_grasshopper_math.h"
99

10-
grasshopper_w128_t grasshopper_pil_enc128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
10+
const grasshopper_w128_t grasshopper_pil_enc128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
1111
{
1212
{
1313
233, 251, 213, 12, 122, 192, 128, 150, 25, 17, 135, 147, 27, 201, 174, 181,
@@ -12329,7 +12329,7 @@ grasshopper_w128_t grasshopper_pil_enc128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
1232912329
},
1233012330
},
1233112331
};
12332-
grasshopper_w128_t grasshopper_pil_dec128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
12332+
const grasshopper_w128_t grasshopper_pil_dec128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
1233312333
{
1233412334
{
1233512335
165, 204, 14, 134, 194, 79, 186, 89, 59, 227, 239, 121, 130, 83, 17, 240,
@@ -24651,7 +24651,7 @@ grasshopper_w128_t grasshopper_pil_dec128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
2465124651
},
2465224652
},
2465324653
};
24654-
grasshopper_w128_t grasshopper_l_dec128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
24654+
const grasshopper_w128_t grasshopper_l_dec128[GRASSHOPPER_MAX_BIT_PARTS][256] = {
2465524655
{
2465624656
{
2465724657
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0 commit comments

Comments
 (0)