Browse Source

Cherry-pick commit: Add support for RSA-OAEP-224, RSA-OAEP-384 and RSA-OAEP-512

Christoph Biedl 1 year ago
parent
commit
a97b893d4e

+ 78 - 0
debian/patches/cherry-pick.v10-4-g9ec5bf7.add-support-for-rsa-oaep-224-rsa-oaep-384-and-rsa-oaep-512.patch

@@ -0,0 +1,78 @@
+Subject: Add support for RSA-OAEP-224, RSA-OAEP-384 and RSA-OAEP-512
+Origin: v10-4-g9ec5bf7 <https://github.com/latchset/jose/commit/v10-4-g9ec5bf7>
+Upstream-Author: Nathaniel McCallum <npmccallum@redhat.com>
+Date: Tue May 1 11:03:10 2018 -0400
+
+--- a/lib/openssl/rsaes.c
++++ b/lib/openssl/rsaes.c
+@@ -26,7 +26,7 @@
+ #include <string.h>
+ 
+ #ifdef EVP_PKEY_CTX_set_rsa_oaep_md
+-#define NAMES "RSA1_5", "RSA-OAEP", "RSA-OAEP-256"
++#define NAMES "RSA1_5", "RSA-OAEP", "RSA-OAEP-224", "RSA-OAEP-256", "RSA-OAEP-384", "RSA-OAEP-512"
+ #define HAVE_OAEP
+ #else
+ #define NAMES "RSA1_5"
+@@ -116,7 +116,10 @@
+     switch (str2enum(alg->name, NAMES, NULL)) {
+     case 0: pad = RSA_PKCS1_PADDING;      tmp = 11; md = EVP_sha1(); break;
+     case 1: pad = RSA_PKCS1_OAEP_PADDING; tmp = 41; md = EVP_sha1(); break;
+-    case 2: pad = RSA_PKCS1_OAEP_PADDING; tmp = 41; md = EVP_sha256(); break;
++    case 2: pad = RSA_PKCS1_OAEP_PADDING; tmp = 41; md = EVP_sha224(); break;
++    case 3: pad = RSA_PKCS1_OAEP_PADDING; tmp = 41; md = EVP_sha256(); break;
++    case 4: pad = RSA_PKCS1_OAEP_PADDING; tmp = 41; md = EVP_sha384(); break;
++    case 5: pad = RSA_PKCS1_OAEP_PADDING; tmp = 41; md = EVP_sha512(); break;
+     default: return false;
+     }
+ 
+@@ -206,7 +209,10 @@
+     switch (str2enum(alg->name, NAMES, NULL)) {
+     case 0: pad = RSA_PKCS1_PADDING;      md = EVP_sha1(); break;
+     case 1: pad = RSA_PKCS1_OAEP_PADDING; md = EVP_sha1(); break;
+-    case 2: pad = RSA_PKCS1_OAEP_PADDING; md = EVP_sha256(); break;
++    case 2: pad = RSA_PKCS1_OAEP_PADDING; md = EVP_sha224(); break;
++    case 3: pad = RSA_PKCS1_OAEP_PADDING; md = EVP_sha256(); break;
++    case 4: pad = RSA_PKCS1_OAEP_PADDING; md = EVP_sha384(); break;
++    case 5: pad = RSA_PKCS1_OAEP_PADDING; md = EVP_sha512(); break;
+     default: return false;
+     }
+ 
+@@ -309,6 +315,14 @@
+           .wrap.enc = alg_wrap_enc,
+           .wrap.wrp = alg_wrap_wrp,
+           .wrap.unw = alg_wrap_unw },
++        { .kind = JOSE_HOOK_ALG_KIND_WRAP,
++          .name = "RSA-OAEP-224",
++          .wrap.eprm = "wrapKey",
++          .wrap.dprm = "unwrapKey",
++          .wrap.alg = alg_wrap_alg,
++          .wrap.enc = alg_wrap_enc,
++          .wrap.wrp = alg_wrap_wrp,
++          .wrap.unw = alg_wrap_unw },
+         { .kind = JOSE_HOOK_ALG_KIND_WRAP,
+           .name = "RSA-OAEP-256",
+           .wrap.eprm = "wrapKey",
+@@ -317,6 +331,22 @@
+           .wrap.enc = alg_wrap_enc,
+           .wrap.wrp = alg_wrap_wrp,
+           .wrap.unw = alg_wrap_unw },
++        { .kind = JOSE_HOOK_ALG_KIND_WRAP,
++          .name = "RSA-OAEP-384",
++          .wrap.eprm = "wrapKey",
++          .wrap.dprm = "unwrapKey",
++          .wrap.alg = alg_wrap_alg,
++          .wrap.enc = alg_wrap_enc,
++          .wrap.wrp = alg_wrap_wrp,
++          .wrap.unw = alg_wrap_unw },
++        { .kind = JOSE_HOOK_ALG_KIND_WRAP,
++          .name = "RSA-OAEP-512",
++          .wrap.eprm = "wrapKey",
++          .wrap.dprm = "unwrapKey",
++          .wrap.alg = alg_wrap_alg,
++          .wrap.enc = alg_wrap_enc,
++          .wrap.wrp = alg_wrap_wrp,
++          .wrap.unw = alg_wrap_unw },
+ #endif
+         {}
+     };

+ 1 - 0
debian/patches/series

@@ -1,6 +1,7 @@
 
 # cherry-picked commits. Keep in upstream's chronological order
 cherry-pick.v10-1-g198f720.fix-minor-file-leak.patch
+cherry-pick.v10-4-g9ec5bf7.add-support-for-rsa-oaep-224-rsa-oaep-384-and-rsa-oaep-512.patch
 
 # patches for upstream
 upstream.typo-fixes.patch