Makes SCT_LIST_set_source return the number of successes
authorRob Percival <robpercival@google.com>
Fri, 4 Mar 2016 20:37:28 +0000 (20:37 +0000)
committerRich Salz <rsalz@openssl.org>
Wed, 9 Mar 2016 16:34:48 +0000 (11:34 -0500)
No longer terminates on first error, but instead tries to set the source
of every SCT regardless of whether an error occurs with some.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/ct/ct_sct.c
include/openssl/ct.h

index 2b7211d7ea42f42cb34e00c649bddc7753839fe6..8290945e513298dd08d83dc38db5a22a5a1091c1 100644 (file)
@@ -317,12 +317,11 @@ int SCT_set_source(SCT *sct, sct_source_t source)
 
 int SCT_LIST_set_source(const STACK_OF(SCT) *scts, sct_source_t source)
 {
-    int i, ret = 1;
+    int i, ret = 0;
 
     for (i = 0; i < sk_SCT_num(scts); ++i) {
-        ret = SCT_set_source(sk_SCT_value(scts, i), source);
-        if (ret != 1)
-            break;
+        if (SCT_set_source(sk_SCT_value(scts, i), source))
+            ++ret;
     }
 
     return ret;
index 6d2182f796f154c5f3de7a822aa25d4809d41272..7a19053018c4f4011a6f6393b1b9cfa2a8ca2303 100644 (file)
@@ -305,7 +305,7 @@ int SCT_set_source(SCT *sct, sct_source_t source);
 
 /*
  * Sets the source of all of the SCTs to the same value.
- * Returns 1 on success.
+ * Returns the number of SCTs whose source was set successfully.
  */
 int SCT_LIST_set_source(const STACK_OF(SCT) *scts, sct_source_t source);