diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-05-01 08:25:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-05-01 08:25:08 +0000 |
commit | 5412caeb1f05aa1083cc3858545a53238dc431ed (patch) | |
tree | 2fc1c816d89305d0be80c75f9244987afbcf0150 /src/cadet/gnunet-service-cadet_tunnel.c | |
parent | ef9610f9db7947b7d516b9e3b8a178ef6a7088a8 (diff) | |
download | gnunet-5412caeb1f05aa1083cc3858545a53238dc431ed.tar.gz gnunet-5412caeb1f05aa1083cc3858545a53238dc431ed.zip |
handle case where type is neither ENCRYPTED nor AX
Diffstat (limited to 'src/cadet/gnunet-service-cadet_tunnel.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index b4eca603d..c73edf48e 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -3088,23 +3088,30 @@ GCT_handle_encrypted (struct CadetTunnel *t, | |||
3088 | unsigned int off; | 3088 | unsigned int off; |
3089 | 3089 | ||
3090 | type = ntohs (msg->type); | 3090 | type = ntohs (msg->type); |
3091 | if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type) | 3091 | switch (type) |
3092 | { | 3092 | { |
3093 | const struct GNUNET_CADET_Encrypted *emsg; | 3093 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: |
3094 | { | ||
3095 | const struct GNUNET_CADET_Encrypted *emsg; | ||
3094 | 3096 | ||
3095 | emsg = (struct GNUNET_CADET_Encrypted *) msg; | 3097 | emsg = (struct GNUNET_CADET_Encrypted *) msg; |
3096 | payload_size = size - sizeof (struct GNUNET_CADET_Encrypted); | 3098 | payload_size = size - sizeof (struct GNUNET_CADET_Encrypted); |
3097 | decrypted_size = t_decrypt_and_validate (t, cbuf, &emsg[1], payload_size, | 3099 | decrypted_size = t_decrypt_and_validate (t, cbuf, &emsg[1], payload_size, |
3098 | emsg->iv, &emsg->hmac); | 3100 | emsg->iv, &emsg->hmac); |
3099 | } | 3101 | } |
3100 | else if (GNUNET_MESSAGE_TYPE_CADET_AX == type) | 3102 | break; |
3101 | { | 3103 | case GNUNET_MESSAGE_TYPE_CADET_AX: |
3102 | const struct GNUNET_CADET_AX *emsg; | 3104 | { |
3105 | const struct GNUNET_CADET_AX *emsg; | ||
3103 | 3106 | ||
3104 | emsg = (struct GNUNET_CADET_AX *) msg; | 3107 | emsg = (struct GNUNET_CADET_AX *) msg; |
3105 | decrypted_size = t_ax_decrypt_and_validate (t, cbuf, emsg, size); | 3108 | decrypted_size = t_ax_decrypt_and_validate (t, cbuf, emsg, size); |
3109 | } | ||
3110 | break; | ||
3111 | default: | ||
3112 | GNUNET_break_op (0); | ||
3113 | return; | ||
3106 | } | 3114 | } |
3107 | |||
3108 | if (-1 == decrypted_size) | 3115 | if (-1 == decrypted_size) |
3109 | { | 3116 | { |
3110 | GNUNET_break_op (0); | 3117 | GNUNET_break_op (0); |