@@ -129,13 +129,6 @@ ossl_bin2hex(unsigned char *in, char *out, size_t inlen)
129129/*
130130 * our default PEM callback
131131 */
132-
133- /*
134- * OpenSSL requires passwords for PEM-encoded files to be at least four
135- * characters long. See crypto/pem/pem_lib.c (as of 1.0.2h)
136- */
137- #define OSSL_MIN_PWD_LEN 4
138-
139132VALUE
140133ossl_pem_passwd_value (VALUE pass )
141134{
@@ -144,8 +137,6 @@ ossl_pem_passwd_value(VALUE pass)
144137
145138 StringValue (pass );
146139
147- if (RSTRING_LEN (pass ) < OSSL_MIN_PWD_LEN )
148- ossl_raise (eOSSLError , "password must be at least %d bytes" , OSSL_MIN_PWD_LEN );
149140 /* PEM_BUFSIZE is currently used as the second argument of pem_password_cb,
150141 * that is +max_len+ of ossl_pem_passwd_cb() */
151142 if (RSTRING_LEN (pass ) > PEM_BUFSIZE )
@@ -178,7 +169,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
178169 * bytes silently if the input is over 1024 bytes */
179170 if (RB_TYPE_P (pass , T_STRING )) {
180171 len = RSTRING_LEN (pass );
181- if (len >= OSSL_MIN_PWD_LEN && len <= max_len ) {
172+ if (len <= max_len ) {
182173 memcpy (buf , RSTRING_PTR (pass ), len );
183174 return (int )len ;
184175 }
@@ -205,10 +196,6 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
205196 return -1 ;
206197 }
207198 len = RSTRING_LEN (pass );
208- if (len < OSSL_MIN_PWD_LEN ) {
209- rb_warning ("password must be at least %d bytes" , OSSL_MIN_PWD_LEN );
210- continue ;
211- }
212199 if (len > max_len ) {
213200 rb_warning ("password must not be longer than %d bytes" , max_len );
214201 continue ;
0 commit comments