shithub: riscv

Download patch

ref: eeb96dca21dfc28afa69f3d00fa6f2cdb7e9b1b8
parent: fac5be2d2eba924b0a78065c9636341b33974e24
author: cinap_lenrek <[email protected]>
date: Thu Feb 11 17:59:25 EST 2016

libsec: simplify pkcs1_decrypt()

--- a/sys/src/libsec/port/tlshand.c
+++ b/sys/src/libsec/port/tlshand.c
@@ -3008,9 +3008,9 @@
 		for(i = 2; i < eb->len; i++)
 			if(eb->data[i] == 0)
 				break;
-		if(i < eb->len - 1){
-			eb->len -= i+1;
-			memmove(eb->data, eb->data+i+1, eb->len);
+		if(++i < eb->len){
+			eb->len -= i;
+			memmove(eb->data, eb->data+i, eb->len);
 			return eb;
 		}
 	}