Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-distro / recipes-security / gssproxy / files / Always-use-the-encype-we-selected.patch
1 From d8166808a98fd1c3772de5d75e27656ed2ab124d Mon Sep 17 00:00:00 2001
2 From: Simo Sorce <simo@redhat.com>
3 Date: Tue, 27 Feb 2018 11:59:25 -0500
4 Subject: [PATCH] Always use the encype we selected
5
6 The enctype is selected from the keytab or from the fallback code.
7 Either way make sure to use the enctype stored in the key block.
8
9 Signed-off-by: Simo Sorce <simo@redhat.com>
10 Reviewed-by: Robbie Harwood <rharwood@redhat.com>
11 Merges: #226
12 (cherry picked from commit d73c96d658059ce64ecd41ff2924071d86f2b54f)
13 ---
14  proxy/src/gp_export.c | 7 +++----
15  1 file changed, 3 insertions(+), 4 deletions(-)
16
17 diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
18 index c9f5fd4..5e8e160 100644
19 --- a/proxy/src/gp_export.c
20 +++ b/proxy/src/gp_export.c
21 @@ -168,11 +168,10 @@ uint32_t gp_init_creds_handle(uint32_t *min, const char *svc_name,
22                                   GP_CREDS_HANDLE_KEY_ENCTYPE, 0,
23                                   &handle->key);
24          if (ret == 0) {
25 -            ret = krb5_c_make_random_key(handle->context,
26 -                                         GP_CREDS_HANDLE_KEY_ENCTYPE,
27 +            ret = krb5_c_make_random_key(handle->context, handle->key->enctype,
28                                           handle->key);
29              GPDEBUG("Service: %s, Enckey: [ephemeral], Enctype: %d\n",
30 -                    svc_name, GP_CREDS_HANDLE_KEY_ENCTYPE);
31 +                    svc_name, handle->key->enctype);
32          }
33          if (ret) {
34              ret_min = ret;
35 @@ -254,7 +253,7 @@ static int gp_decrypt_buffer(krb5_context context, krb5_keyblock *key,
36  
37      memset(&enc_handle, '\0', sizeof(krb5_enc_data));
38  
39 -    enc_handle.enctype = GP_CREDS_HANDLE_KEY_ENCTYPE;
40 +    enc_handle.enctype = key->enctype;
41      enc_handle.ciphertext.data = in->octet_string_val;
42      enc_handle.ciphertext.length = in->octet_string_len;
43