diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Symbols.namespace | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/curve25519/curve25519.c | 7 | ||||
| -rw-r--r-- | src/lib/libcrypto/hidden/openssl/curve25519.h | 34 |
3 files changed, 45 insertions, 1 deletions
diff --git a/src/lib/libcrypto/Symbols.namespace b/src/lib/libcrypto/Symbols.namespace index a3aeb7fc75..4770e8f9d2 100644 --- a/src/lib/libcrypto/Symbols.namespace +++ b/src/lib/libcrypto/Symbols.namespace | |||
| @@ -2701,3 +2701,8 @@ _libre_CRYPTO_ccm128_encrypt_ccm64 | |||
| 2701 | _libre_CRYPTO_ccm128_decrypt_ccm64 | 2701 | _libre_CRYPTO_ccm128_decrypt_ccm64 |
| 2702 | _libre_CRYPTO_ccm128_tag | 2702 | _libre_CRYPTO_ccm128_tag |
| 2703 | _libre_CRYPTO_xts128_encrypt | 2703 | _libre_CRYPTO_xts128_encrypt |
| 2704 | _libre_X25519_keypair | ||
| 2705 | _libre_X25519 | ||
| 2706 | _libre_ED25519_keypair | ||
| 2707 | _libre_ED25519_sign | ||
| 2708 | _libre_ED25519_verify | ||
diff --git a/src/lib/libcrypto/curve25519/curve25519.c b/src/lib/libcrypto/curve25519/curve25519.c index 4f85a81f47..4e644c4280 100644 --- a/src/lib/libcrypto/curve25519/curve25519.c +++ b/src/lib/libcrypto/curve25519/curve25519.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: curve25519.c,v 1.15 2023/04/02 15:36:53 tb Exp $ */ | 1 | /* $OpenBSD: curve25519.c,v 1.16 2023/07/08 15:12:49 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015, Google Inc. | 3 | * Copyright (c) 2015, Google Inc. |
| 4 | * | 4 | * |
| @@ -4636,6 +4636,7 @@ void ED25519_keypair(uint8_t out_public_key[ED25519_PUBLIC_KEY_LENGTH], | |||
| 4636 | 4636 | ||
| 4637 | ED25519_public_from_private(out_public_key, out_private_key); | 4637 | ED25519_public_from_private(out_public_key, out_private_key); |
| 4638 | } | 4638 | } |
| 4639 | LCRYPTO_ALIAS(ED25519_keypair); | ||
| 4639 | 4640 | ||
| 4640 | int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, | 4641 | int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, |
| 4641 | const uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH], | 4642 | const uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH], |
| @@ -4671,6 +4672,7 @@ int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, | |||
| 4671 | 4672 | ||
| 4672 | return 1; | 4673 | return 1; |
| 4673 | } | 4674 | } |
| 4675 | LCRYPTO_ALIAS(ED25519_sign); | ||
| 4674 | 4676 | ||
| 4675 | /* | 4677 | /* |
| 4676 | * Little endian representation of the order of edwards25519, | 4678 | * Little endian representation of the order of edwards25519, |
| @@ -4735,6 +4737,7 @@ int ED25519_verify(const uint8_t *message, size_t message_len, | |||
| 4735 | 4737 | ||
| 4736 | return timingsafe_memcmp(rcheck, rcopy, sizeof(rcheck)) == 0; | 4738 | return timingsafe_memcmp(rcheck, rcopy, sizeof(rcheck)) == 0; |
| 4737 | } | 4739 | } |
| 4740 | LCRYPTO_ALIAS(ED25519_verify); | ||
| 4738 | 4741 | ||
| 4739 | /* Replace (f,g) with (g,f) if b == 1; | 4742 | /* Replace (f,g) with (g,f) if b == 1; |
| 4740 | * replace (f,g) with (f,g) if b == 0. | 4743 | * replace (f,g) with (f,g) if b == 0. |
| @@ -4926,6 +4929,7 @@ X25519_keypair(uint8_t out_public_key[X25519_KEY_LENGTH], | |||
| 4926 | 4929 | ||
| 4927 | X25519_public_from_private(out_public_key, out_private_key); | 4930 | X25519_public_from_private(out_public_key, out_private_key); |
| 4928 | } | 4931 | } |
| 4932 | LCRYPTO_ALIAS(X25519_keypair); | ||
| 4929 | 4933 | ||
| 4930 | int | 4934 | int |
| 4931 | X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], | 4935 | X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], |
| @@ -4939,3 +4943,4 @@ X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], | |||
| 4939 | /* The all-zero output results when the input is a point of small order. */ | 4943 | /* The all-zero output results when the input is a point of small order. */ |
| 4940 | return timingsafe_memcmp(kZeros, out_shared_key, 32) != 0; | 4944 | return timingsafe_memcmp(kZeros, out_shared_key, 32) != 0; |
| 4941 | } | 4945 | } |
| 4946 | LCRYPTO_ALIAS(X25519); | ||
diff --git a/src/lib/libcrypto/hidden/openssl/curve25519.h b/src/lib/libcrypto/hidden/openssl/curve25519.h new file mode 100644 index 0000000000..3afa324e0a --- /dev/null +++ b/src/lib/libcrypto/hidden/openssl/curve25519.h | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* $OpenBSD: curve25519.h,v 1.1 2023/07/08 15:12:49 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_CURVE25519_H | ||
| 19 | #define _LIBCRYPTO_CURVE25519_H | ||
| 20 | |||
| 21 | #ifndef _MSC_VER | ||
| 22 | #include_next <openssl/curve25519.h> | ||
| 23 | #else | ||
| 24 | #include "../include/openssl/curve25519.h" | ||
| 25 | #endif | ||
| 26 | #include "crypto_namespace.h" | ||
| 27 | |||
| 28 | LCRYPTO_USED(X25519_keypair); | ||
| 29 | LCRYPTO_USED(X25519); | ||
| 30 | LCRYPTO_USED(ED25519_keypair); | ||
| 31 | LCRYPTO_USED(ED25519_sign); | ||
| 32 | LCRYPTO_USED(ED25519_verify); | ||
| 33 | |||
| 34 | #endif /* _LIBCRYPTO_CURVE25519_H */ | ||
