diff options
author | tb <> | 2022-11-13 14:04:13 +0000 |
---|---|---|
committer | tb <> | 2022-11-13 14:04:13 +0000 |
commit | 7812b27139ea6df6c7bcc8b2ee92c7bbb0f28950 (patch) | |
tree | 21080c96058836b92ff5bb5d418223f1f4f1b5d6 | |
parent | 089aa75149cb470a0c42f4bac12272196cd9e60b (diff) | |
download | openbsd-7812b27139ea6df6c7bcc8b2ee92c7bbb0f28950.tar.gz openbsd-7812b27139ea6df6c7bcc8b2ee92c7bbb0f28950.tar.bz2 openbsd-7812b27139ea6df6c7bcc8b2ee92c7bbb0f28950.zip |
Expose various EVP hooks for Ed25519 and X25519
This adds the EVP_PKEY_ED25519 and EVP_PKEY_X25519 aliases for the NIDs
and exposes the raw public key API.
The ED25519_KEYLEN and X25519_KEYLEN defines are still kept internal for
now to match what OpenSSL have. We may want to expose those later.
-rw-r--r-- | src/lib/libcrypto/evp/evp.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index f8bab26b3f..4cb4dac5ad 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp.h,v 1.111 2022/11/10 16:37:52 jsing Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.112 2022/11/13 14:04:13 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -115,10 +115,8 @@ | |||
115 | #define EVP_PKEY_HKDF NID_hkdf | 115 | #define EVP_PKEY_HKDF NID_hkdf |
116 | #define EVP_PKEY_GOSTR12_256 NID_id_tc26_gost3410_2012_256 | 116 | #define EVP_PKEY_GOSTR12_256 NID_id_tc26_gost3410_2012_256 |
117 | #define EVP_PKEY_GOSTR12_512 NID_id_tc26_gost3410_2012_512 | 117 | #define EVP_PKEY_GOSTR12_512 NID_id_tc26_gost3410_2012_512 |
118 | #if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | ||
119 | #define EVP_PKEY_ED25519 NID_ED25519 | 118 | #define EVP_PKEY_ED25519 NID_ED25519 |
120 | #define EVP_PKEY_X25519 NID_X25519 | 119 | #define EVP_PKEY_X25519 NID_X25519 |
121 | #endif | ||
122 | 120 | ||
123 | #ifdef __cplusplus | 121 | #ifdef __cplusplus |
124 | extern "C" { | 122 | extern "C" { |
@@ -301,7 +299,8 @@ extern "C" { | |||
301 | /* Length of tag for TLS */ | 299 | /* Length of tag for TLS */ |
302 | #define EVP_CHACHAPOLY_TLS_TAG_LEN 16 | 300 | #define EVP_CHACHAPOLY_TLS_TAG_LEN 16 |
303 | 301 | ||
304 | #if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | 302 | /* XXX - do we want to expose these? */ |
303 | #if defined(LIBRESSL_INTERNAL) | ||
305 | #define ED25519_KEYLEN 32 | 304 | #define ED25519_KEYLEN 32 |
306 | #define X25519_KEYLEN 32 | 305 | #define X25519_KEYLEN 32 |
307 | #endif | 306 | #endif |
@@ -408,7 +407,6 @@ unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); | |||
408 | unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); | 407 | unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); |
409 | #define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) | 408 | #define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) |
410 | 409 | ||
411 | #if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | ||
412 | EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *engine, | 410 | EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *engine, |
413 | const unsigned char *private_key, size_t len); | 411 | const unsigned char *private_key, size_t len); |
414 | EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *engine, | 412 | EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *engine, |
@@ -417,7 +415,6 @@ int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, | |||
417 | unsigned char *out_private_key, size_t *out_len); | 415 | unsigned char *out_private_key, size_t *out_len); |
418 | int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, | 416 | int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, |
419 | unsigned char *out_public_key, size_t *out_len); | 417 | unsigned char *out_public_key, size_t *out_len); |
420 | #endif | ||
421 | 418 | ||
422 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) | 419 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) |
423 | #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) | 420 | #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) |