You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2020/05/18 16:55:04 UTC

[GitHub] [mina-sshd] lgoldstein commented on a change in pull request #132: [SSHD-506] Add support for RFC 5647

lgoldstein commented on a change in pull request #132:
URL: https://github.com/apache/mina-sshd/pull/132#discussion_r426765217



##########
File path: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
##########
@@ -1249,6 +1260,20 @@ protected Buffer encode(Buffer buffer) throws IOException {
         }
     }
 
+    protected void aeadOutgoingBuffer(Buffer buf, int offset, int len) throws Exception {
+        if (outCipher instanceof BaseGCMCipher) {

Review comment:
       I would throw an exception here if this is not a `BaseGCMCipher` since only such ciphers are expected to reach this code

##########
File path: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
##########
@@ -1334,9 +1362,19 @@ protected void decode() throws Exception {
                 assert decoderBuffer.rpos() == Integer.BYTES;
                 int macSize = (inMac != null) ? inMacSize : 0;
                 // Check if the packet has been fully received
-                if (decoderBuffer.available() >= (decoderLength + macSize)) {
+                if (decoderBuffer.available() >= (decoderLength + macSize + authLen)) {
                     byte[] data = decoderBuffer.array();
-                    if (etmMode) {
+                    if (authMode) {
+                        final BaseGCMCipher cipher = (BaseGCMCipher) inCipher;

Review comment:
       No need for `final` - we don't use it in these cases




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org