diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Symbols.namespace | 42 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gost2814789.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gost89_params.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gost_asn1.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gost_err.c | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gostr341001_key.c | 15 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gostr341194.c | 7 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/streebog.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/hidden/openssl/gost.h | 71 |
9 files changed, 160 insertions, 5 deletions
diff --git a/src/lib/libcrypto/Symbols.namespace b/src/lib/libcrypto/Symbols.namespace index 7676e45f90..6e6d27bd4e 100644 --- a/src/lib/libcrypto/Symbols.namespace +++ b/src/lib/libcrypto/Symbols.namespace | |||
| @@ -2631,3 +2631,45 @@ _libre_DSA_meth_set1_name | |||
| 2631 | _libre_DSA_meth_set_sign | 2631 | _libre_DSA_meth_set_sign |
| 2632 | _libre_DSA_meth_set_finish | 2632 | _libre_DSA_meth_set_finish |
| 2633 | _libre_ERR_load_DSA_strings | 2633 | _libre_ERR_load_DSA_strings |
| 2634 | _libre_Gost2814789_set_sbox | ||
| 2635 | _libre_Gost2814789_set_key | ||
| 2636 | _libre_Gost2814789_ecb_encrypt | ||
| 2637 | _libre_Gost2814789_cfb64_encrypt | ||
| 2638 | _libre_Gost2814789_cnt_encrypt | ||
| 2639 | _libre_GOST_CIPHER_PARAMS_new | ||
| 2640 | _libre_GOST_CIPHER_PARAMS_free | ||
| 2641 | _libre_d2i_GOST_CIPHER_PARAMS | ||
| 2642 | _libre_i2d_GOST_CIPHER_PARAMS | ||
| 2643 | _libre_GOST2814789IMIT_Init | ||
| 2644 | _libre_GOST2814789IMIT_Update | ||
| 2645 | _libre_GOST2814789IMIT_Final | ||
| 2646 | _libre_GOST2814789IMIT_Transform | ||
| 2647 | _libre_GOST2814789IMIT | ||
| 2648 | _libre_GOSTR341194_Init | ||
| 2649 | _libre_GOSTR341194_Update | ||
| 2650 | _libre_GOSTR341194_Final | ||
| 2651 | _libre_GOSTR341194_Transform | ||
| 2652 | _libre_GOSTR341194 | ||
| 2653 | _libre_STREEBOG256_Init | ||
| 2654 | _libre_STREEBOG256_Update | ||
| 2655 | _libre_STREEBOG256_Final | ||
| 2656 | _libre_STREEBOG256 | ||
| 2657 | _libre_STREEBOG512_Init | ||
| 2658 | _libre_STREEBOG512_Update | ||
| 2659 | _libre_STREEBOG512_Final | ||
| 2660 | _libre_STREEBOG512_Transform | ||
| 2661 | _libre_STREEBOG512 | ||
| 2662 | _libre_GOST_KEY_new | ||
| 2663 | _libre_GOST_KEY_free | ||
| 2664 | _libre_GOST_KEY_check_key | ||
| 2665 | _libre_GOST_KEY_set_public_key_affine_coordinates | ||
| 2666 | _libre_GOST_KEY_get0_group | ||
| 2667 | _libre_GOST_KEY_set_group | ||
| 2668 | _libre_GOST_KEY_get_digest | ||
| 2669 | _libre_GOST_KEY_set_digest | ||
| 2670 | _libre_GOST_KEY_get0_private_key | ||
| 2671 | _libre_GOST_KEY_set_private_key | ||
| 2672 | _libre_GOST_KEY_get0_public_key | ||
| 2673 | _libre_GOST_KEY_set_public_key | ||
| 2674 | _libre_GOST_KEY_get_size | ||
| 2675 | _libre_ERR_load_GOST_strings | ||
diff --git a/src/lib/libcrypto/gost/gost2814789.c b/src/lib/libcrypto/gost/gost2814789.c index 1e0f17da43..dac3a8eab8 100644 --- a/src/lib/libcrypto/gost/gost2814789.c +++ b/src/lib/libcrypto/gost/gost2814789.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gost2814789.c,v 1.8 2022/11/26 16:08:53 tb Exp $ */ | 1 | /* $OpenBSD: gost2814789.c,v 1.9 2023/07/08 14:30:44 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
| @@ -180,6 +180,7 @@ Gost2814789_ecb_encrypt(const unsigned char *in, unsigned char *out, | |||
| 180 | else | 180 | else |
| 181 | Gost2814789_decrypt(in, out, key); | 181 | Gost2814789_decrypt(in, out, key); |
| 182 | } | 182 | } |
| 183 | LCRYPTO_ALIAS(Gost2814789_ecb_encrypt); | ||
| 183 | 184 | ||
| 184 | static inline void | 185 | static inline void |
| 185 | Gost2814789_encrypt_mesh(unsigned char *iv, GOST2814789_KEY *key) | 186 | Gost2814789_encrypt_mesh(unsigned char *iv, GOST2814789_KEY *key) |
| @@ -318,6 +319,7 @@ Gost2814789_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
| 318 | *num = n; | 319 | *num = n; |
| 319 | } | 320 | } |
| 320 | } | 321 | } |
| 322 | LCRYPTO_ALIAS(Gost2814789_cfb64_encrypt); | ||
| 321 | 323 | ||
| 322 | static inline void | 324 | static inline void |
| 323 | Gost2814789_cnt_next(unsigned char *ivec, unsigned char *out, | 325 | Gost2814789_cnt_next(unsigned char *ivec, unsigned char *out, |
| @@ -403,6 +405,7 @@ Gost2814789_cnt_encrypt(const unsigned char *in, unsigned char *out, size_t len, | |||
| 403 | 405 | ||
| 404 | *num=n; | 406 | *num=n; |
| 405 | } | 407 | } |
| 408 | LCRYPTO_ALIAS(Gost2814789_cnt_encrypt); | ||
| 406 | 409 | ||
| 407 | int | 410 | int |
| 408 | GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) | 411 | GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) |
| @@ -411,6 +414,7 @@ GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) | |||
| 411 | memset(c->mac, 0, 8); | 414 | memset(c->mac, 0, 8); |
| 412 | return Gost2814789_set_sbox(&c->cipher, nid); | 415 | return Gost2814789_set_sbox(&c->cipher, nid); |
| 413 | } | 416 | } |
| 417 | LCRYPTO_ALIAS(GOST2814789IMIT_Init); | ||
| 414 | 418 | ||
| 415 | static void | 419 | static void |
| 416 | GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, | 420 | GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, |
| @@ -435,6 +439,8 @@ GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, | |||
| 435 | #define HASH_BLOCK_DATA_ORDER GOST2814789IMIT_block_data_order | 439 | #define HASH_BLOCK_DATA_ORDER GOST2814789IMIT_block_data_order |
| 436 | 440 | ||
| 437 | #include "md32_common.h" | 441 | #include "md32_common.h" |
| 442 | LCRYPTO_ALIAS(GOST2814789IMIT_Update); | ||
| 443 | LCRYPTO_ALIAS(GOST2814789IMIT_Transform); | ||
| 438 | 444 | ||
| 439 | int | 445 | int |
| 440 | GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) | 446 | GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) |
| @@ -450,6 +456,7 @@ GOST2814789IMIT_Final(unsigned char *md, GOST2814789IMIT_CTX *c) | |||
| 450 | memcpy(md, c->mac, 4); | 456 | memcpy(md, c->mac, 4); |
| 451 | return 1; | 457 | return 1; |
| 452 | } | 458 | } |
| 459 | LCRYPTO_ALIAS(GOST2814789IMIT_Final); | ||
| 453 | 460 | ||
| 454 | unsigned char * | 461 | unsigned char * |
| 455 | GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, | 462 | GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, |
| @@ -468,5 +475,6 @@ GOST2814789IMIT(const unsigned char *d, size_t n, unsigned char *md, int nid, | |||
| 468 | explicit_bzero(&c, sizeof(c)); | 475 | explicit_bzero(&c, sizeof(c)); |
| 469 | return (md); | 476 | return (md); |
| 470 | } | 477 | } |
| 478 | LCRYPTO_ALIAS(GOST2814789IMIT); | ||
| 471 | 479 | ||
| 472 | #endif | 480 | #endif |
diff --git a/src/lib/libcrypto/gost/gost89_params.c b/src/lib/libcrypto/gost/gost89_params.c index 9c4a97ee6d..ef9c9cde6b 100644 --- a/src/lib/libcrypto/gost/gost89_params.c +++ b/src/lib/libcrypto/gost/gost89_params.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gost89_params.c,v 1.3 2022/11/26 16:08:53 tb Exp $ */ | 1 | /* $OpenBSD: gost89_params.c,v 1.4 2023/07/08 14:30:44 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
| @@ -211,6 +211,7 @@ Gost2814789_set_sbox(GOST2814789_KEY *key, int nid) | |||
| 211 | 211 | ||
| 212 | return 1; | 212 | return 1; |
| 213 | } | 213 | } |
| 214 | LCRYPTO_ALIAS(Gost2814789_set_sbox); | ||
| 214 | 215 | ||
| 215 | int | 216 | int |
| 216 | Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, | 217 | Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, |
| @@ -228,6 +229,7 @@ Gost2814789_set_key(GOST2814789_KEY *key, const unsigned char *userKey, | |||
| 228 | 229 | ||
| 229 | return 1; | 230 | return 1; |
| 230 | } | 231 | } |
| 232 | LCRYPTO_ALIAS(Gost2814789_set_key); | ||
| 231 | 233 | ||
| 232 | void | 234 | void |
| 233 | Gost2814789_cryptopro_key_mesh(GOST2814789_KEY *key) | 235 | Gost2814789_cryptopro_key_mesh(GOST2814789_KEY *key) |
diff --git a/src/lib/libcrypto/gost/gost_asn1.c b/src/lib/libcrypto/gost/gost_asn1.c index d83ded55b1..28e3a58e53 100644 --- a/src/lib/libcrypto/gost/gost_asn1.c +++ b/src/lib/libcrypto/gost/gost_asn1.c | |||
| @@ -273,23 +273,27 @@ d2i_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS **a, const unsigned char **in, long le | |||
| 273 | return (GOST_CIPHER_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | 273 | return (GOST_CIPHER_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, |
| 274 | &GOST_CIPHER_PARAMS_it); | 274 | &GOST_CIPHER_PARAMS_it); |
| 275 | } | 275 | } |
| 276 | LCRYPTO_ALIAS(d2i_GOST_CIPHER_PARAMS); | ||
| 276 | 277 | ||
| 277 | int | 278 | int |
| 278 | i2d_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS *a, unsigned char **out) | 279 | i2d_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS *a, unsigned char **out) |
| 279 | { | 280 | { |
| 280 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_CIPHER_PARAMS_it); | 281 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_CIPHER_PARAMS_it); |
| 281 | } | 282 | } |
| 283 | LCRYPTO_ALIAS(i2d_GOST_CIPHER_PARAMS); | ||
| 282 | 284 | ||
| 283 | GOST_CIPHER_PARAMS * | 285 | GOST_CIPHER_PARAMS * |
| 284 | GOST_CIPHER_PARAMS_new(void) | 286 | GOST_CIPHER_PARAMS_new(void) |
| 285 | { | 287 | { |
| 286 | return (GOST_CIPHER_PARAMS *)ASN1_item_new(&GOST_CIPHER_PARAMS_it); | 288 | return (GOST_CIPHER_PARAMS *)ASN1_item_new(&GOST_CIPHER_PARAMS_it); |
| 287 | } | 289 | } |
| 290 | LCRYPTO_ALIAS(GOST_CIPHER_PARAMS_new); | ||
| 288 | 291 | ||
| 289 | void | 292 | void |
| 290 | GOST_CIPHER_PARAMS_free(GOST_CIPHER_PARAMS *a) | 293 | GOST_CIPHER_PARAMS_free(GOST_CIPHER_PARAMS *a) |
| 291 | { | 294 | { |
| 292 | ASN1_item_free((ASN1_VALUE *)a, &GOST_CIPHER_PARAMS_it); | 295 | ASN1_item_free((ASN1_VALUE *)a, &GOST_CIPHER_PARAMS_it); |
| 293 | } | 296 | } |
| 297 | LCRYPTO_ALIAS(GOST_CIPHER_PARAMS_free); | ||
| 294 | 298 | ||
| 295 | #endif | 299 | #endif |
diff --git a/src/lib/libcrypto/gost/gost_err.c b/src/lib/libcrypto/gost/gost_err.c index 0c46dbc36c..380f60289e 100644 --- a/src/lib/libcrypto/gost/gost_err.c +++ b/src/lib/libcrypto/gost/gost_err.c | |||
| @@ -103,3 +103,4 @@ ERR_load_GOST_strings(void) { | |||
| 103 | } | 103 | } |
| 104 | #endif | 104 | #endif |
| 105 | } | 105 | } |
| 106 | LCRYPTO_ALIAS(ERR_load_GOST_strings); | ||
diff --git a/src/lib/libcrypto/gost/gostr341001_key.c b/src/lib/libcrypto/gost/gostr341001_key.c index 62694318d5..efc9e57452 100644 --- a/src/lib/libcrypto/gost/gostr341001_key.c +++ b/src/lib/libcrypto/gost/gostr341001_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gostr341001_key.c,v 1.12 2023/03/07 09:27:10 jsing Exp $ */ | 1 | /* $OpenBSD: gostr341001_key.c,v 1.13 2023/07/08 14:30:44 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
| @@ -88,6 +88,7 @@ GOST_KEY_new(void) | |||
| 88 | ret->digest_nid = NID_undef; | 88 | ret->digest_nid = NID_undef; |
| 89 | return (ret); | 89 | return (ret); |
| 90 | } | 90 | } |
| 91 | LCRYPTO_ALIAS(GOST_KEY_new); | ||
| 91 | 92 | ||
| 92 | void | 93 | void |
| 93 | GOST_KEY_free(GOST_KEY *r) | 94 | GOST_KEY_free(GOST_KEY *r) |
| @@ -107,6 +108,7 @@ GOST_KEY_free(GOST_KEY *r) | |||
| 107 | 108 | ||
| 108 | freezero(r, sizeof(GOST_KEY)); | 109 | freezero(r, sizeof(GOST_KEY)); |
| 109 | } | 110 | } |
| 111 | LCRYPTO_ALIAS(GOST_KEY_free); | ||
| 110 | 112 | ||
| 111 | int | 113 | int |
| 112 | GOST_KEY_check_key(const GOST_KEY *key) | 114 | GOST_KEY_check_key(const GOST_KEY *key) |
| @@ -176,6 +178,7 @@ err: | |||
| 176 | EC_POINT_free(point); | 178 | EC_POINT_free(point); |
| 177 | return (ok); | 179 | return (ok); |
| 178 | } | 180 | } |
| 181 | LCRYPTO_ALIAS(GOST_KEY_check_key); | ||
| 179 | 182 | ||
| 180 | int | 183 | int |
| 181 | GOST_KEY_set_public_key_affine_coordinates(GOST_KEY *key, BIGNUM *x, BIGNUM *y) | 184 | GOST_KEY_set_public_key_affine_coordinates(GOST_KEY *key, BIGNUM *x, BIGNUM *y) |
| @@ -232,12 +235,14 @@ err: | |||
| 232 | return ok; | 235 | return ok; |
| 233 | 236 | ||
| 234 | } | 237 | } |
| 238 | LCRYPTO_ALIAS(GOST_KEY_set_public_key_affine_coordinates); | ||
| 235 | 239 | ||
| 236 | const EC_GROUP * | 240 | const EC_GROUP * |
| 237 | GOST_KEY_get0_group(const GOST_KEY *key) | 241 | GOST_KEY_get0_group(const GOST_KEY *key) |
| 238 | { | 242 | { |
| 239 | return key->group; | 243 | return key->group; |
| 240 | } | 244 | } |
| 245 | LCRYPTO_ALIAS(GOST_KEY_get0_group); | ||
| 241 | 246 | ||
| 242 | int | 247 | int |
| 243 | GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) | 248 | GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) |
| @@ -246,12 +251,14 @@ GOST_KEY_set_group(GOST_KEY *key, const EC_GROUP *group) | |||
| 246 | key->group = EC_GROUP_dup(group); | 251 | key->group = EC_GROUP_dup(group); |
| 247 | return (key->group == NULL) ? 0 : 1; | 252 | return (key->group == NULL) ? 0 : 1; |
| 248 | } | 253 | } |
| 254 | LCRYPTO_ALIAS(GOST_KEY_set_group); | ||
| 249 | 255 | ||
| 250 | const BIGNUM * | 256 | const BIGNUM * |
| 251 | GOST_KEY_get0_private_key(const GOST_KEY *key) | 257 | GOST_KEY_get0_private_key(const GOST_KEY *key) |
| 252 | { | 258 | { |
| 253 | return key->priv_key; | 259 | return key->priv_key; |
| 254 | } | 260 | } |
| 261 | LCRYPTO_ALIAS(GOST_KEY_get0_private_key); | ||
| 255 | 262 | ||
| 256 | int | 263 | int |
| 257 | GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) | 264 | GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) |
| @@ -260,12 +267,14 @@ GOST_KEY_set_private_key(GOST_KEY *key, const BIGNUM *priv_key) | |||
| 260 | key->priv_key = BN_dup(priv_key); | 267 | key->priv_key = BN_dup(priv_key); |
| 261 | return (key->priv_key == NULL) ? 0 : 1; | 268 | return (key->priv_key == NULL) ? 0 : 1; |
| 262 | } | 269 | } |
| 270 | LCRYPTO_ALIAS(GOST_KEY_set_private_key); | ||
| 263 | 271 | ||
| 264 | const EC_POINT * | 272 | const EC_POINT * |
| 265 | GOST_KEY_get0_public_key(const GOST_KEY *key) | 273 | GOST_KEY_get0_public_key(const GOST_KEY *key) |
| 266 | { | 274 | { |
| 267 | return key->pub_key; | 275 | return key->pub_key; |
| 268 | } | 276 | } |
| 277 | LCRYPTO_ALIAS(GOST_KEY_get0_public_key); | ||
| 269 | 278 | ||
| 270 | int | 279 | int |
| 271 | GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) | 280 | GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) |
| @@ -274,12 +283,14 @@ GOST_KEY_set_public_key(GOST_KEY *key, const EC_POINT *pub_key) | |||
| 274 | key->pub_key = EC_POINT_dup(pub_key, key->group); | 283 | key->pub_key = EC_POINT_dup(pub_key, key->group); |
| 275 | return (key->pub_key == NULL) ? 0 : 1; | 284 | return (key->pub_key == NULL) ? 0 : 1; |
| 276 | } | 285 | } |
| 286 | LCRYPTO_ALIAS(GOST_KEY_set_public_key); | ||
| 277 | 287 | ||
| 278 | int | 288 | int |
| 279 | GOST_KEY_get_digest(const GOST_KEY *key) | 289 | GOST_KEY_get_digest(const GOST_KEY *key) |
| 280 | { | 290 | { |
| 281 | return key->digest_nid; | 291 | return key->digest_nid; |
| 282 | } | 292 | } |
| 293 | LCRYPTO_ALIAS(GOST_KEY_get_digest); | ||
| 283 | int | 294 | int |
| 284 | GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) | 295 | GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) |
| 285 | { | 296 | { |
| @@ -292,6 +303,7 @@ GOST_KEY_set_digest(GOST_KEY *key, int digest_nid) | |||
| 292 | 303 | ||
| 293 | return 0; | 304 | return 0; |
| 294 | } | 305 | } |
| 306 | LCRYPTO_ALIAS(GOST_KEY_set_digest); | ||
| 295 | 307 | ||
| 296 | size_t | 308 | size_t |
| 297 | GOST_KEY_get_size(const GOST_KEY *r) | 309 | GOST_KEY_get_size(const GOST_KEY *r) |
| @@ -318,4 +330,5 @@ GOST_KEY_get_size(const GOST_KEY *r) | |||
| 318 | BN_free(order); | 330 | BN_free(order); |
| 319 | return (i); | 331 | return (i); |
| 320 | } | 332 | } |
| 333 | LCRYPTO_ALIAS(GOST_KEY_get_size); | ||
| 321 | #endif | 334 | #endif |
diff --git a/src/lib/libcrypto/gost/gostr341194.c b/src/lib/libcrypto/gost/gostr341194.c index 63058300a3..311c304539 100644 --- a/src/lib/libcrypto/gost/gostr341194.c +++ b/src/lib/libcrypto/gost/gostr341194.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gostr341194.c,v 1.6 2022/11/26 16:08:53 tb Exp $ */ | 1 | /* $OpenBSD: gostr341194.c,v 1.7 2023/07/08 14:30:44 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
| @@ -205,6 +205,7 @@ GOSTR341194_Init(GOSTR341194_CTX *c, int nid) | |||
| 205 | memset(c, 0, sizeof(*c)); | 205 | memset(c, 0, sizeof(*c)); |
| 206 | return Gost2814789_set_sbox(&c->cipher, nid); | 206 | return Gost2814789_set_sbox(&c->cipher, nid); |
| 207 | } | 207 | } |
| 208 | LCRYPTO_ALIAS(GOSTR341194_Init); | ||
| 208 | 209 | ||
| 209 | static void | 210 | static void |
| 210 | GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, | 211 | GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, |
| @@ -230,6 +231,8 @@ GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, | |||
| 230 | #define HASH_BLOCK_DATA_ORDER GOSTR341194_block_data_order | 231 | #define HASH_BLOCK_DATA_ORDER GOSTR341194_block_data_order |
| 231 | 232 | ||
| 232 | #include "md32_common.h" | 233 | #include "md32_common.h" |
| 234 | LCRYPTO_ALIAS(GOSTR341194_Update); | ||
| 235 | LCRYPTO_ALIAS(GOSTR341194_Transform); | ||
| 233 | 236 | ||
| 234 | int | 237 | int |
| 235 | GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) | 238 | GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) |
| @@ -254,6 +257,7 @@ GOSTR341194_Final(unsigned char *md, GOSTR341194_CTX * c) | |||
| 254 | 257 | ||
| 255 | return 1; | 258 | return 1; |
| 256 | } | 259 | } |
| 260 | LCRYPTO_ALIAS(GOSTR341194_Final); | ||
| 257 | 261 | ||
| 258 | unsigned char * | 262 | unsigned char * |
| 259 | GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) | 263 | GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) |
| @@ -270,4 +274,5 @@ GOSTR341194(const unsigned char *d, size_t n, unsigned char *md, int nid) | |||
| 270 | explicit_bzero(&c, sizeof(c)); | 274 | explicit_bzero(&c, sizeof(c)); |
| 271 | return (md); | 275 | return (md); |
| 272 | } | 276 | } |
| 277 | LCRYPTO_ALIAS(GOSTR341194); | ||
| 273 | #endif | 278 | #endif |
diff --git a/src/lib/libcrypto/gost/streebog.c b/src/lib/libcrypto/gost/streebog.c index 2785fca619..60c575794c 100644 --- a/src/lib/libcrypto/gost/streebog.c +++ b/src/lib/libcrypto/gost/streebog.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: streebog.c,v 1.8 2022/11/26 16:08:53 tb Exp $ */ | 1 | /* $OpenBSD: streebog.c,v 1.9 2023/07/08 14:30:44 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
| @@ -1365,12 +1365,14 @@ STREEBOG512_Final(unsigned char *md, STREEBOG_CTX *c) | |||
| 1365 | 1365 | ||
| 1366 | return 1; | 1366 | return 1; |
| 1367 | } | 1367 | } |
| 1368 | LCRYPTO_ALIAS(STREEBOG512_Final); | ||
| 1368 | 1369 | ||
| 1369 | int | 1370 | int |
| 1370 | STREEBOG256_Final(unsigned char *md, STREEBOG_CTX * c) | 1371 | STREEBOG256_Final(unsigned char *md, STREEBOG_CTX * c) |
| 1371 | { | 1372 | { |
| 1372 | return STREEBOG512_Final(md, c); | 1373 | return STREEBOG512_Final(md, c); |
| 1373 | } | 1374 | } |
| 1375 | LCRYPTO_ALIAS(STREEBOG256_Final); | ||
| 1374 | 1376 | ||
| 1375 | int | 1377 | int |
| 1376 | STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) | 1378 | STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) |
| @@ -1411,18 +1413,21 @@ STREEBOG512_Update(STREEBOG_CTX *c, const void *_data, size_t len) | |||
| 1411 | 1413 | ||
| 1412 | return 1; | 1414 | return 1; |
| 1413 | } | 1415 | } |
| 1416 | LCRYPTO_ALIAS(STREEBOG512_Update); | ||
| 1414 | 1417 | ||
| 1415 | int | 1418 | int |
| 1416 | STREEBOG256_Update(STREEBOG_CTX *c, const void *data, size_t len) | 1419 | STREEBOG256_Update(STREEBOG_CTX *c, const void *data, size_t len) |
| 1417 | { | 1420 | { |
| 1418 | return STREEBOG512_Update(c, data, len); | 1421 | return STREEBOG512_Update(c, data, len); |
| 1419 | } | 1422 | } |
| 1423 | LCRYPTO_ALIAS(STREEBOG256_Update); | ||
| 1420 | 1424 | ||
| 1421 | void | 1425 | void |
| 1422 | STREEBOG512_Transform(STREEBOG_CTX *c, const unsigned char *data) | 1426 | STREEBOG512_Transform(STREEBOG_CTX *c, const unsigned char *data) |
| 1423 | { | 1427 | { |
| 1424 | streebog_block_data_order(c, data, 1); | 1428 | streebog_block_data_order(c, data, 1); |
| 1425 | } | 1429 | } |
| 1430 | LCRYPTO_ALIAS(STREEBOG512_Transform); | ||
| 1426 | 1431 | ||
| 1427 | int | 1432 | int |
| 1428 | STREEBOG256_Init(STREEBOG_CTX *c) | 1433 | STREEBOG256_Init(STREEBOG_CTX *c) |
| @@ -1433,6 +1438,7 @@ STREEBOG256_Init(STREEBOG_CTX *c) | |||
| 1433 | c->md_len = STREEBOG256_LENGTH; | 1438 | c->md_len = STREEBOG256_LENGTH; |
| 1434 | return 1; | 1439 | return 1; |
| 1435 | } | 1440 | } |
| 1441 | LCRYPTO_ALIAS(STREEBOG256_Init); | ||
| 1436 | 1442 | ||
| 1437 | int | 1443 | int |
| 1438 | STREEBOG512_Init(STREEBOG_CTX *c) | 1444 | STREEBOG512_Init(STREEBOG_CTX *c) |
| @@ -1444,6 +1450,7 @@ STREEBOG512_Init(STREEBOG_CTX *c) | |||
| 1444 | c->md_len = STREEBOG512_LENGTH; | 1450 | c->md_len = STREEBOG512_LENGTH; |
| 1445 | return 1; | 1451 | return 1; |
| 1446 | } | 1452 | } |
| 1453 | LCRYPTO_ALIAS(STREEBOG512_Init); | ||
| 1447 | 1454 | ||
| 1448 | unsigned char * | 1455 | unsigned char * |
| 1449 | STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) | 1456 | STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) |
| @@ -1459,6 +1466,7 @@ STREEBOG256(const unsigned char *d, size_t n, unsigned char *md) | |||
| 1459 | explicit_bzero(&c, sizeof(c)); | 1466 | explicit_bzero(&c, sizeof(c)); |
| 1460 | return (md); | 1467 | return (md); |
| 1461 | } | 1468 | } |
| 1469 | LCRYPTO_ALIAS(STREEBOG256); | ||
| 1462 | 1470 | ||
| 1463 | unsigned char * | 1471 | unsigned char * |
| 1464 | STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) | 1472 | STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) |
| @@ -1474,5 +1482,6 @@ STREEBOG512(const unsigned char *d, size_t n, unsigned char *md) | |||
| 1474 | explicit_bzero(&c, sizeof(c)); | 1482 | explicit_bzero(&c, sizeof(c)); |
| 1475 | return (md); | 1483 | return (md); |
| 1476 | } | 1484 | } |
| 1485 | LCRYPTO_ALIAS(STREEBOG512); | ||
| 1477 | 1486 | ||
| 1478 | #endif | 1487 | #endif |
diff --git a/src/lib/libcrypto/hidden/openssl/gost.h b/src/lib/libcrypto/hidden/openssl/gost.h new file mode 100644 index 0000000000..e30e6611af --- /dev/null +++ b/src/lib/libcrypto/hidden/openssl/gost.h | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* $OpenBSD: gost.h,v 1.1 2023/07/08 14:30:44 beck Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _LIBCRYPTO_GOST_H | ||
| 19 | #define _LIBCRYPTO_GOST_H | ||
| 20 | |||
| 21 | #ifndef _MSC_VER | ||
| 22 | #include_next <openssl/gost.h> | ||
| 23 | #else | ||
| 24 | #include "../include/openssl/gost.h" | ||
| 25 | #endif | ||
| 26 | #include "crypto_namespace.h" | ||
| 27 | |||
| 28 | LCRYPTO_USED(Gost2814789_set_sbox); | ||
| 29 | LCRYPTO_USED(Gost2814789_set_key); | ||
| 30 | LCRYPTO_USED(Gost2814789_ecb_encrypt); | ||
| 31 | LCRYPTO_USED(Gost2814789_cfb64_encrypt); | ||
| 32 | LCRYPTO_USED(Gost2814789_cnt_encrypt); | ||
| 33 | LCRYPTO_USED(GOST_CIPHER_PARAMS_new); | ||
| 34 | LCRYPTO_USED(GOST_CIPHER_PARAMS_free); | ||
| 35 | LCRYPTO_USED(d2i_GOST_CIPHER_PARAMS); | ||
| 36 | LCRYPTO_USED(i2d_GOST_CIPHER_PARAMS); | ||
| 37 | LCRYPTO_USED(GOST2814789IMIT_Init); | ||
| 38 | LCRYPTO_USED(GOST2814789IMIT_Update); | ||
| 39 | LCRYPTO_USED(GOST2814789IMIT_Final); | ||
| 40 | LCRYPTO_USED(GOST2814789IMIT_Transform); | ||
| 41 | LCRYPTO_USED(GOST2814789IMIT); | ||
| 42 | LCRYPTO_USED(GOSTR341194_Init); | ||
| 43 | LCRYPTO_USED(GOSTR341194_Update); | ||
| 44 | LCRYPTO_USED(GOSTR341194_Final); | ||
| 45 | LCRYPTO_USED(GOSTR341194_Transform); | ||
| 46 | LCRYPTO_USED(GOSTR341194); | ||
| 47 | LCRYPTO_USED(STREEBOG256_Init); | ||
| 48 | LCRYPTO_USED(STREEBOG256_Update); | ||
| 49 | LCRYPTO_USED(STREEBOG256_Final); | ||
| 50 | LCRYPTO_USED(STREEBOG256); | ||
| 51 | LCRYPTO_USED(STREEBOG512_Init); | ||
| 52 | LCRYPTO_USED(STREEBOG512_Update); | ||
| 53 | LCRYPTO_USED(STREEBOG512_Final); | ||
| 54 | LCRYPTO_USED(STREEBOG512_Transform); | ||
| 55 | LCRYPTO_USED(STREEBOG512); | ||
| 56 | LCRYPTO_USED(GOST_KEY_new); | ||
| 57 | LCRYPTO_USED(GOST_KEY_free); | ||
| 58 | LCRYPTO_USED(GOST_KEY_check_key); | ||
| 59 | LCRYPTO_USED(GOST_KEY_set_public_key_affine_coordinates); | ||
| 60 | LCRYPTO_USED(GOST_KEY_get0_group); | ||
| 61 | LCRYPTO_USED(GOST_KEY_set_group); | ||
| 62 | LCRYPTO_USED(GOST_KEY_get_digest); | ||
| 63 | LCRYPTO_USED(GOST_KEY_set_digest); | ||
| 64 | LCRYPTO_USED(GOST_KEY_get0_private_key); | ||
| 65 | LCRYPTO_USED(GOST_KEY_set_private_key); | ||
| 66 | LCRYPTO_USED(GOST_KEY_get0_public_key); | ||
| 67 | LCRYPTO_USED(GOST_KEY_set_public_key); | ||
| 68 | LCRYPTO_USED(GOST_KEY_get_size); | ||
| 69 | LCRYPTO_USED(ERR_load_GOST_strings); | ||
| 70 | |||
| 71 | #endif /* _LIBCRYPTO_GOST_H */ | ||
