Add padding spaces before printing signature algorithm for CRLs output
[openssl.git] / crypto / evp / m_sha1.c
index 4f009560b338e6fbd4671834fffde438ce7ddfb4..0fa184b3107ca899973b1ce7084a88cb1c54a53f 100644 (file)
@@ -36,11 +36,16 @@ static int ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms)
     unsigned char padtmp[40];
     unsigned char sha1tmp[SHA_DIGEST_LENGTH];
 
-    SHA_CTX *sha1 = EVP_MD_CTX_md_data(ctx);
+    SHA_CTX *sha1;
 
     if (cmd != EVP_CTRL_SSL3_MASTER_SECRET)
+        return -2;
+
+    if (ctx == NULL)
         return 0;
 
+    sha1 = EVP_MD_CTX_md_data(ctx);
+
     /* SSLv3 client auth handling: see RFC-6101 5.6.8 */
     if (mslen != 48)
         return 0;
@@ -102,7 +107,7 @@ static const EVP_MD sha1_md = {
 
 const EVP_MD *EVP_sha1(void)
 {
-    return (&sha1_md);
+    return &sha1_md;
 }
 
 static int init224(EVP_MD_CTX *ctx)
@@ -146,7 +151,7 @@ static const EVP_MD sha224_md = {
 
 const EVP_MD *EVP_sha224(void)
 {
-    return (&sha224_md);
+    return &sha224_md;
 }
 
 static const EVP_MD sha256_md = {
@@ -165,7 +170,7 @@ static const EVP_MD sha256_md = {
 
 const EVP_MD *EVP_sha256(void)
 {
-    return (&sha256_md);
+    return &sha256_md;
 }
 
 static int init384(EVP_MD_CTX *ctx)
@@ -205,7 +210,7 @@ static const EVP_MD sha384_md = {
 
 const EVP_MD *EVP_sha384(void)
 {
-    return (&sha384_md);
+    return &sha384_md;
 }
 
 static const EVP_MD sha512_md = {
@@ -224,5 +229,5 @@ static const EVP_MD sha512_md = {
 
 const EVP_MD *EVP_sha512(void)
 {
-    return (&sha512_md);
+    return &sha512_md;
 }