Add support for reference counting using C11 atomics
[openssl.git] / crypto / ec / ecp_nistp224.c
index 0c11abc0895f79ae204bad6cf3fcc8c7cc28aacc..cf56368fb2d3993947a1078e67f1dfc18bc44aba 100644 (file)
@@ -236,7 +236,7 @@ static const felem gmul[2][16][3] = {
 /* Precomputation for the group generator. */
 struct nistp224_pre_comp_st {
     felem g_pre_comp[2][16][3];
-    int references;
+    CRYPTO_REF_COUNT references;
     CRYPTO_RWLOCK *lock;
 };
 
@@ -1239,7 +1239,7 @@ NISTP224_PRE_COMP *EC_nistp224_pre_comp_dup(NISTP224_PRE_COMP *p)
 {
     int i;
     if (p != NULL)
-        CRYPTO_atomic_add(&p->references, 1, &i, p->lock);
+        CRYPTO_UP_REF(&p->references, &i, p->lock);
     return p;
 }
 
@@ -1250,7 +1250,7 @@ void EC_nistp224_pre_comp_free(NISTP224_PRE_COMP *p)
     if (p == NULL)
         return;
 
-    CRYPTO_atomic_add(&p->references, -1, &i, p->lock);
+    CRYPTO_DOWN_REF(&p->references, &i, p->lock);
     REF_PRINT_COUNT("EC_nistp224", x);
     if (i > 0)
         return;