@@ -88,6 +88,18 @@ static int s_cmp_zero(const padding_testcase* t, const unsigned char* p, unsigne
8888 return CRYPT_OK ;
8989}
9090
91+ static int s_cmp_ssh (const padding_testcase * t , const unsigned char * p , unsigned long len )
92+ {
93+ unsigned long n , diff = len - t -> is ;
94+ unsigned char pad = 0x1 ;
95+ DOX (EQ (len , t -> should ), t -> name );
96+ for (n = len - diff ; n < len ; ++ n ) {
97+ DOX (EQ (p [n ], pad ), t -> name );
98+ pad ++ ;
99+ }
100+ return CRYPT_OK ;
101+ }
102+
91103static int s_padding_testrun (const padding_testcase * t )
92104{
93105 unsigned long len ;
@@ -126,6 +138,13 @@ int padding_test(void)
126138 { 255 , 256 , 0 , LTC_PAD_ANSI_X923 | 16 , "255-x923" , s_cmp_x923 },
127139 { 256 , 272 , 0 , LTC_PAD_ANSI_X923 | 16 , "256-x923" , s_cmp_x923 },
128140
141+ { 0 , 16 , 0 , LTC_PAD_SSH | 16 , "0-ssh" , s_cmp_ssh },
142+ { 1 , 16 , 0 , LTC_PAD_SSH | 16 , "1-ssh" , s_cmp_ssh },
143+ { 15 , 16 , 0 , LTC_PAD_SSH | 16 , "15-ssh" , s_cmp_ssh },
144+ { 16 , 32 , 0 , LTC_PAD_SSH | 16 , "16-ssh" , s_cmp_ssh },
145+ { 255 , 256 , 0 , LTC_PAD_SSH | 16 , "255-ssh" , s_cmp_ssh },
146+ { 256 , 272 , 0 , LTC_PAD_SSH | 16 , "256-ssh" , s_cmp_ssh },
147+
129148 { 0 , 16 , 0 , LTC_PAD_ONE_AND_ZERO | 16 , "0-one-and-zero" , s_cmp_oaz },
130149 { 1 , 16 , 0 , LTC_PAD_ONE_AND_ZERO | 16 , "1-one-and-zero" , s_cmp_oaz },
131150 { 15 , 16 , 0 , LTC_PAD_ONE_AND_ZERO | 16 , "15-one-and-zero" , s_cmp_oaz },
0 commit comments