summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa.h
diff options
context:
space:
mode:
authorjsing <>2019-10-29 08:00:18 +0000
committerjsing <>2019-10-29 08:00:18 +0000
commitea080b270c97cb89cf1984550c9125f8b38b0caf (patch)
tree5aa520500126d3b5a6e1e7ef6c87bc4b779ecc58 /src/lib/libcrypto/rsa/rsa.h
parentc20b0b4d3d1da89ee904502f4241815376c15133 (diff)
downloadopenbsd-ea080b270c97cb89cf1984550c9125f8b38b0caf.tar.gz
openbsd-ea080b270c97cb89cf1984550c9125f8b38b0caf.tar.bz2
openbsd-ea080b270c97cb89cf1984550c9125f8b38b0caf.zip
Update RSA OAEP code.
This syncs the RSA OAEP code with OpenSSL 1.1.1d, correctly handling OAEP padding and providing various OAEP related controls. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa.h')
-rw-r--r--src/lib/libcrypto/rsa/rsa.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index db10049e0e..d3f9bee3a5 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa.h,v 1.43 2019/10/24 15:54:29 jsing Exp $ */ 1/* $OpenBSD: rsa.h,v 1.44 2019/10/29 08:00:18 jsing 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 *
@@ -237,17 +237,39 @@ struct rsa_st {
237 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG, \ 237 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_SIG, \
238 EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd) 238 EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd)
239 239
240#define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) 240#define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \
241#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) 241 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
242 EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md))
242 243
243#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) 244#define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \
244#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) 245 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
245#define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) 246 EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd))
247
248#define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \
249 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
250 EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l))
251
252#define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \
253 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
254 EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l))
255
256#define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1)
257#define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2)
258
259#define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3)
260#define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
261#define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5)
246 262
247#define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) 263#define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6)
248#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) 264#define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7)
249#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) 265#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8)
250 266
267#define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9)
268#define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10)
269
270#define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11)
271#define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12)
272
251#define RSA_PKCS1_PADDING 1 273#define RSA_PKCS1_PADDING 1
252#define RSA_SSLV23_PADDING 2 274#define RSA_SSLV23_PADDING 2
253#define RSA_NO_PADDING 3 275#define RSA_NO_PADDING 3