/* Decrypt one block using CBC. */ static krb5_error_code cbc_decr(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data, size_t num_data) { int ret = 0, olen = BLOCK_SIZE; unsigned char iblock[BLOCK_SIZE], oblock[BLOCK_SIZE]; EVP_CIPHER_CTX ciph_ctx; struct iov_block_state input_pos, output_pos; EVP_CIPHER_CTX_init(&ciph_ctx); ret = EVP_DecryptInit_ex(&ciph_ctx, map_mode(key->keyblock.length), NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); if (ret == 0) return KRB5_CRYPTO_INTERNAL; IOV_BLOCK_STATE_INIT(&input_pos); IOV_BLOCK_STATE_INIT(&output_pos); krb5int_c_iov_get_block(iblock, BLOCK_SIZE, data, num_data, &input_pos); EVP_CIPHER_CTX_set_padding(&ciph_ctx,0); ret = EVP_DecryptUpdate(&ciph_ctx, oblock, &olen, iblock, BLOCK_SIZE); if (ret == 1) { krb5int_c_iov_put_block(data, num_data, oblock, BLOCK_SIZE, &output_pos); } EVP_CIPHER_CTX_cleanup(&ciph_ctx); zap(iblock, BLOCK_SIZE); zap(oblock, BLOCK_SIZE); return (ret == 1) ? 0 : KRB5_CRYPTO_INTERNAL; }
/* Decrypt one block using CBC. */ static krb5_error_code cbc_decr(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data, size_t num_data) { int ret = 0, olen = BLOCK_SIZE; unsigned char iblock[BLOCK_SIZE], oblock[BLOCK_SIZE]; EVP_CIPHER_CTX *ctx; struct iov_cursor cursor; ctx = EVP_CIPHER_CTX_new(); if (ctx == NULL) return ENOMEM; ret = EVP_DecryptInit_ex(ctx, map_mode(key->keyblock.length), NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); if (ret == 0) { EVP_CIPHER_CTX_free(ctx); return KRB5_CRYPTO_INTERNAL; } k5_iov_cursor_init(&cursor, data, num_data, BLOCK_SIZE, FALSE); k5_iov_cursor_get(&cursor, iblock); EVP_CIPHER_CTX_set_padding(ctx,0); ret = EVP_DecryptUpdate(ctx, oblock, &olen, iblock, BLOCK_SIZE); if (ret == 1) k5_iov_cursor_put(&cursor, oblock); EVP_CIPHER_CTX_free(ctx); zap(iblock, BLOCK_SIZE); zap(oblock, BLOCK_SIZE); return (ret == 1) ? 0 : KRB5_CRYPTO_INTERNAL; }
/* Reseed the generator using the accumulator pools. */ static void accumulator_reseed(struct fortuna_state *st) { unsigned int i, n; SHA256_CTX ctx; unsigned char hash_result[SHA256_HASHSIZE]; n = ++st->reseed_count; /* * Collect entropy from pools. We use the i-th pool only 1/(2^i) of the * time so that each pool collects twice as much entropy between uses as * the last. */ shad256_init(&ctx); for (i = 0; i < NUM_POOLS; i++) { if (n % (1 << i) != 0) break; /* Harvest this pool's hash result into ctx, then reset the pool. */ shad256_result(&st->pool[i], hash_result); shad256_init(&st->pool[i]); shad256_update(&ctx, hash_result, SHA256_HASHSIZE); } shad256_result(&ctx, hash_result); generator_reseed(st, hash_result, SHA256_HASHSIZE); zap(hash_result, SHA256_HASHSIZE); zap(&ctx, sizeof(ctx)); /* Reset the count of bytes added to pool 0. */ st->pool0_bytes = 0; }
void forward(void) { char b; // 600 IF F(1)>0 AND F(1)<7 THEN GOTO 660 if (f[0]==1) { // 660 B=INT(RND(1)*3+1) // 670 SHOOT:PRINT SPC(5) TX$(B) :WAIT8*TI:SHOOT:CLS // 672 IF B=2 THEN ZAP:SHOOT:ZAP shoot(); printf(" "); b = rand()%3; printf(message[b]); wait(360); shoot(); cls(); if (b==1) { zap();shoot();zap(); } } else if(f[0]>1 && f[0]<7) { shoot(); printf("Prenez la porte, mais pas comme ca !"); wait(360); cls(); } else { s_old = s; x_old = x; y_old = y; switch(s) { case 0: if(y>0) y--; break; case 1: if(x<XMAX) x++; break; case 2: if(y<XMAX) y++; break; case 3: if(x>0) x--; break; default: printf("erreur forward\n"); } } // 330 CASE=C(X,Y) ca = c[x+y*XMAX]; prep(); drawLaby(); manageCell(); }
static krb5_error_code cts_decr(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data, size_t num_data, size_t dlen) { int ret = 0; size_t size = 0; unsigned char *oblock = NULL; unsigned char *dbuf = NULL; unsigned char iv_cts[IV_CTS_BUF_SIZE]; struct iov_block_state input_pos, output_pos; AES_KEY deck; memset(iv_cts,0,sizeof(iv_cts)); if (ivec && ivec->data){ if (ivec->length != sizeof(iv_cts)) return KRB5_CRYPTO_INTERNAL; memcpy(iv_cts, ivec->data,ivec->length); } IOV_BLOCK_STATE_INIT(&input_pos); IOV_BLOCK_STATE_INIT(&output_pos); oblock = OPENSSL_malloc(dlen); if (!oblock) return ENOMEM; dbuf = OPENSSL_malloc(dlen); if (!dbuf){ OPENSSL_free(oblock); return ENOMEM; } AES_set_decrypt_key(key->keyblock.contents, NUM_BITS * key->keyblock.length, &deck); krb5int_c_iov_get_block(dbuf, dlen, data, num_data, &input_pos); size = CRYPTO_cts128_decrypt((unsigned char *)dbuf, oblock, dlen, &deck, iv_cts, (cbc128_f)AES_cbc_encrypt); if (size <= 0) ret = KRB5_CRYPTO_INTERNAL; else { krb5int_c_iov_put_block(data, num_data, oblock, dlen, &output_pos); } if (!ret && ivec && ivec->data) memcpy(ivec->data, iv_cts, sizeof(iv_cts)); zap(oblock, dlen); zap(dbuf, dlen); OPENSSL_free(oblock); OPENSSL_free(dbuf); return ret; }
void HPFUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int channel) throw() { double piOverSampleRate = UGen::getReciprocalSampleRate() * pi; int numSamplesToProcess = uGenOutput.getBlockSize(); float* outputSamples = uGenOutput.getSampleData(); float* inputSamples = inputs[Input].processBlock(shouldDelete, blockID, channel); float* freqSamples = inputs[Freq].processBlock(shouldDelete, blockID, channel); float y0; float newFreq = *freqSamples; if(newFreq != currentFreq) { float slope = 1.f / numSamplesToProcess; float pfreq = (float)(max(0.01f, newFreq) * piOverSampleRate); float C = tan(pfreq); float C2 = C * C; float sqrt2C = (float)(C * sqrt2); float next_a0 = 1.f / (1.f + sqrt2C + C2); float next_b1 = 2.f * (1.f - C2) * next_a0 ; float next_b2 = -(1.f - sqrt2C + C2) * next_a0; float a0_slope = (next_a0 - a0) * slope; float b1_slope = (next_b1 - b1) * slope; float b2_slope = (next_b2 - b2) * slope; while(numSamplesToProcess--) { y0 = *inputSamples++ + b1 * y1 + b2 * y2; *outputSamples++ = a0 * (y0 - 2.f * y1 + y2); y2 = y1; y1 = y0; a0 += a0_slope; b1 += b1_slope; b2 += b2_slope; } } else { while(numSamplesToProcess--) { y0 = *inputSamples++ + b1 * y1 + b2 * y2; *outputSamples++ = a0 * (y0 - 2.f * y1 + y2); y2 = y1; y1 = y0; } } y1 = zap(y1); y2 = zap(y2); currentFreq = newFreq; }
static krb5_error_code k5_des3_encrypt(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data, size_t num_data) { int ret, olen = MIT_DES_BLOCK_LENGTH; unsigned char iblock[MIT_DES_BLOCK_LENGTH], oblock[MIT_DES_BLOCK_LENGTH]; struct iov_block_state input_pos, output_pos; EVP_CIPHER_CTX ciph_ctx; krb5_boolean empty; ret = validate(key, ivec, data, num_data, &empty); if (ret != 0 || empty) return ret; IOV_BLOCK_STATE_INIT(&input_pos); IOV_BLOCK_STATE_INIT(&output_pos); EVP_CIPHER_CTX_init(&ciph_ctx); ret = EVP_EncryptInit_ex(&ciph_ctx, EVP_des_ede3_cbc(), NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); if (!ret) return KRB5_CRYPTO_INTERNAL; EVP_CIPHER_CTX_set_padding(&ciph_ctx,0); for (;;) { if (!krb5int_c_iov_get_block(iblock, MIT_DES_BLOCK_LENGTH, data, num_data, &input_pos)) break; ret = EVP_EncryptUpdate(&ciph_ctx, oblock, &olen, (unsigned char *)iblock, MIT_DES_BLOCK_LENGTH); if (!ret) break; krb5int_c_iov_put_block(data, num_data, oblock, MIT_DES_BLOCK_LENGTH, &output_pos); } if (ivec != NULL) memcpy(ivec->data, oblock, MIT_DES_BLOCK_LENGTH); EVP_CIPHER_CTX_cleanup(&ciph_ctx); zap(iblock, sizeof(iblock)); zap(oblock, sizeof(oblock)); if (ret != 1) return KRB5_CRYPTO_INTERNAL; return 0; }
void FSinOscUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int channel) throw() { float* outputSamples = uGenOutput.getSampleData(); float newFreq = *(inputs[Freq].processBlock(shouldDelete, blockID, channel)); double y0; LOCAL_DECLARE(double, b1); LOCAL_DECLARE(double, y1); LOCAL_DECLARE(double, y2); if(newFreq != currentFreq) { currentFreq = newFreq; double initialPhase; if((1.0-std::abs(y1)) < 0.00001) { initialPhase = y1 > 0.0 ? piOverTwo : -piOverTwo; } else { initialPhase = std::asin(y1); // based on the trajectory predict which solution of asin(y1) is correct.. if(y2 >= y1) { double piVersion = y1 > 0.0 ? pi : -pi; initialPhase = piVersion - initialPhase; } } double w = currentFreq * twoPi * UGen::getReciprocalSampleRate(); b1 = zap(2. * std::cos(w)); y1 = zap(std::sin(initialPhase)); y2 = zap(std::sin(initialPhase-w)); } int numSamplesToProcess = uGenOutput.getBlockSize(); for(int i = 0; i < numSamplesToProcess; ++i) { y0 = b1 * y1 - y2; outputSamples[i] = y0;// = b1 * y1 - y2; y2 = y1; y1 = y0; } y1 = zap(y1); y2 = zap(y2); LOCAL_COPY(b1); LOCAL_COPY(y1); LOCAL_COPY(y2); }
/* * k5_des3_encrypt: Encrypt data buffer using 3DES. * * @key DES key (with odd parity) * @ivec Initialization Vector * @data Input/Output buffer (in-place encryption, block-by-block) * @num_data Number of blocks * * Returns 0 on success, krb5_error_code on error */ static krb5_error_code k5_des3_encrypt(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data, size_t num_data) { int ret; Des3 des3; unsigned char iv[DES_BLOCK_SIZE]; unsigned char iblock[DES_BLOCK_SIZE]; unsigned char oblock[DES_BLOCK_SIZE]; //struct iov_block_state input_pos, output_pos; struct iov_cursor cursor; krb5_boolean empty; ret = validate(key, ivec, data, num_data, &empty); if (ret != 0 || empty) return ret; memset(iv, 0, sizeof(iv)); /* Check if IV exists and is the correct size */ if (ivec && ivec->data) { if (ivec->length != sizeof(iv)) return KRB5_CRYPTO_INTERNAL; memcpy(iv, ivec->data, ivec->length); } Des3_SetKey(&des3, key->keyblock.contents, iv, DES_ENCRYPTION); k5_iov_cursor_init(&cursor, data, num_data, DES_BLOCK_SIZE, FALSE); for (;;) { if (!k5_iov_cursor_get(&cursor, iblock)) break; Des3_CbcEncrypt(&des3, oblock, iblock, DES_BLOCK_SIZE); k5_iov_cursor_put(&cursor, oblock); } if (ivec != NULL) memcpy(ivec->data, oblock, DES_BLOCK_SIZE); zap(iv, sizeof(iv)); zap(iblock, sizeof(iblock)); zap(oblock, sizeof(oblock)); return 0; }
static krb5_error_code cts_decr(krb5_key key, const krb5_data *ivec, krb5_crypto_iov *data, size_t num_data, size_t dlen) { int ret = 0; size_t size = 0; unsigned char *oblock = NULL; unsigned char *dbuf = NULL; unsigned char iv_cts[IV_CTS_BUF_SIZE]; struct iov_cursor cursor; AES_KEY deck; memset(iv_cts,0,sizeof(iv_cts)); if (ivec && ivec->data) { if (ivec->length != sizeof(iv_cts)) return KRB5_CRYPTO_INTERNAL; memcpy(iv_cts, ivec->data,ivec->length); } oblock = OPENSSL_malloc(dlen); if (!oblock) return ENOMEM; dbuf = OPENSSL_malloc(dlen); if (!dbuf) { OPENSSL_free(oblock); return ENOMEM; } AES_set_decrypt_key(key->keyblock.contents, NUM_BITS * key->keyblock.length, &deck); k5_iov_cursor_init(&cursor, data, num_data, dlen, FALSE); k5_iov_cursor_get(&cursor, dbuf); size = CRYPTO_cts128_decrypt((unsigned char *)dbuf, oblock, dlen, &deck, iv_cts, (cbc128_f)AES_cbc_encrypt); if (size <= 0) ret = KRB5_CRYPTO_INTERNAL; else k5_iov_cursor_put(&cursor, oblock); if (!ret && ivec && ivec->data) memcpy(ivec->data, iv_cts, sizeof(iv_cts)); zap(oblock, dlen); zap(dbuf, dlen); OPENSSL_free(oblock); OPENSSL_free(dbuf); return ret; }
static void dct_unquantize_h263_inter_axp(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, n_coeffs; uint64_t qmul, qadd; uint64_t correction; qadd = WORD_VEC((qscale - 1) | 1); qmul = qscale << 1; /* This mask kills spill from negative subwords to the next subword. */ correction = WORD_VEC((qmul - 1) + 1); /* multiplication / addition */ n_coeffs = s->intra_scantable.raster_end[s->block_last_index[n]]; for(i = 0; i <= n_coeffs; block += 4, i += 4) { uint64_t levels, negmask, zeros, add; levels = ldq(block); if (levels == 0) continue; #ifdef __alpha_max__ /* I don't think the speed difference justifies runtime detection. */ negmask = maxsw4(levels, -1); /* negative -> ffff (-1) */ negmask = minsw4(negmask, 0); /* positive -> 0000 (0) */ #else negmask = cmpbge(WORD_VEC(0x7fff), levels); negmask &= (negmask >> 1) | (1 << 7); negmask = zap(-1, negmask); #endif zeros = cmpbge(0, levels); zeros &= zeros >> 1; /* zeros |= zeros << 1 is not needed since qadd <= 255, so zapping the lower byte suffices. */ levels *= qmul; levels -= correction & (negmask << 16); /* Negate qadd for negative levels. */ add = qadd ^ negmask; add += WORD_VEC(0x0001) & negmask; /* Set qadd to 0 for levels == 0. */ add = zap(add, zeros); levels += add; stq(levels, block); } }
void DroneThread::resendImportantStuff() { qDebug() << Q_FUNC_INFO << cameraMode << m_fly; zap(cameraMode); setFly(m_fly); return; sendCmd("AT*CONFIG=%1,\"general:navdata_demo\",\"TRUE\"\r"); }
/* Drop the ref count. If it hits zero, remove the entry from the fcc_set list * and free it. */ static krb5_error_code dereference(krb5_context context, fcc_data *data) { struct fcc_set **fccsp, *temp; k5_cc_mutex_lock(context, &krb5int_cc_file_mutex); for (fccsp = &fccs; *fccsp != NULL; fccsp = &(*fccsp)->next) { if ((*fccsp)->data == data) break; } assert(*fccsp != NULL); assert((*fccsp)->data == data); (*fccsp)->refcount--; if ((*fccsp)->refcount == 0) { data = (*fccsp)->data; temp = *fccsp; *fccsp = (*fccsp)->next; free(temp); k5_cc_mutex_unlock(context, &krb5int_cc_file_mutex); k5_cc_mutex_assert_unlocked(context, &data->lock); free(data->filename); zap(data->buf, sizeof(data->buf)); if (data->fd >= 0) { k5_cc_mutex_lock(context, &data->lock); close_cache_file(context, data); k5_cc_mutex_unlock(context, &data->lock); } k5_cc_mutex_destroy(&data->lock); free(data); } else { k5_cc_mutex_unlock(context, &krb5int_cc_file_mutex); } return 0; }
int main () { int *p, *p1, *p2, i; clock_t cl_start, cl_finish; double sek; p = NULL; p1 = NULL; p2 = NULL; scanf ("%d", &kvanto); p = (int*) malloc(kvanto * sizeof(int)); p1 = (int*) malloc(kvanto * sizeof(int)); p2 = (int*) malloc(kvanto * sizeof(int)); if ((p != NULL)&&(p1 != NULL)&&(p2 != NULL)) { zap(p,p1,p2,kvanto); cl_start = clock(); podschet(p,kvanto); cl_finish = clock(); sek = cl_finish - cl_start; sek = sek / CLOCKS_PER_SEC; printf("%f\n",sek); cl_start = clock(); rascheska(p1,kvanto); cl_finish = clock(); sek = cl_finish - cl_start; sek = sek / CLOCKS_PER_SEC; printf("%f\n",sek); cl_start = clock(); puzyrok(p2,kvanto); cl_finish = clock(); sek = cl_finish - cl_start; sek = sek / CLOCKS_PER_SEC; printf("%f\n",sek); } if (p != NULL) { free(p); } if (p1 != NULL) { free(p1); } if (p2 != NULL) { free(p2); } getch(); return 0; }
void k5_prng_cleanup(void) { have_entropy = FALSE; zap(&main_state, sizeof(main_state)); k5_mutex_destroy(&fortuna_lock); }
/* * Clear memory of sensitive data */ void ANSI_X919_MAC::clear() { m_des1->clear(); m_des2->clear(); zap(m_state); m_position = 0; }
int main() { Foo f; f.waga(); zap(); f.waga(); return 0; }
/* Output pseudo-random data from the generator. */ static void generator_output(struct fortuna_state *st, unsigned char *dst, size_t len) { unsigned char result[AES256_BLOCKSIZE]; size_t n, count = 0; while (len > 0) { /* Produce bytes and copy the result into dst. */ encrypt_counter(st, result); n = (len < AES256_BLOCKSIZE) ? len : AES256_BLOCKSIZE; memcpy(dst, result, n); dst += n; len -= n; /* Each time we reach MAX_BYTES_PER_KEY bytes, change the key. */ count += AES256_BLOCKSIZE; if (count >= MAX_BYTES_PER_KEY) { change_key(st); count = 0; } } zap(result, sizeof(result)); /* Change the key after each request. */ change_key(st); }
static void dct_unquantize_h263_axp(DCTELEM *block, int n_coeffs, uint64_t qscale, uint64_t qadd) { uint64_t qmul = qscale << 1; uint64_t correction = WORD_VEC(qmul * 255 >> 8); int i; qadd = WORD_VEC(qadd); for(i = 0; i <= n_coeffs; block += 4, i += 4) { uint64_t levels, negmask, zeros, add, sub; levels = ldq(block); if (levels == 0) continue; #ifdef __alpha_max__ /* I don't think the speed difference justifies runtime detection. */ negmask = maxsw4(levels, -1); /* negative -> ffff (-1) */ negmask = minsw4(negmask, 0); /* positive -> 0000 (0) */ #else negmask = cmpbge(WORD_VEC(0x7fff), levels); negmask &= (negmask >> 1) | (1 << 7); negmask = zap(-1, negmask); #endif zeros = cmpbge(0, levels); zeros &= zeros >> 1; /* zeros |= zeros << 1 is not needed since qadd <= 255, so zapping the lower byte suffices. */ levels *= qmul; levels -= correction & (negmask << 16); add = qadd & ~negmask; sub = qadd & negmask; /* Set qadd to 0 for levels == 0. */ add = zap(add, zeros); levels += add; levels -= sub; stq(levels, block); } }
//------ Begin of function NewsArray::reset -----// //! //! Reset all news display options and clear all news in the log //! void NewsArray::reset() { zap(); // clear all news in the log last_clear_recno = 0; news_add_flag = 1; default_setting(); }
jobject JNIHandleBlock::allocate_handle(oop obj) { assert(Universe::heap()->is_in_reserved(obj), "sanity check"); if (_top == 0) { // This is the first allocation or the initial block got zapped when // entering a native function. If we have any following blocks they are // not valid anymore. for (JNIHandleBlock* current = _next; current != NULL; current = current->_next) { assert(current->_last == NULL, "only first block should have _last set"); assert(current->_free_list == NULL, "only first block should have _free_list set"); current->_top = 0; if (ZapJNIHandleArea) current->zap(); } // Clear initial block _free_list = NULL; _allocate_before_rebuild = 0; _last = this; if (ZapJNIHandleArea) zap(); } // Try last block if (_last->_top < block_size_in_oops) { oop* handle = &(_last->_handles)[_last->_top++]; *handle = obj; return (jobject) handle; } // Try free list if (_free_list != NULL) { oop* handle = _free_list; _free_list = (oop*) *_free_list; *handle = obj; return (jobject) handle; } // Check if unused block follow last if (_last->_next != NULL) { // update last and retry _last = _last->_next; return allocate_handle(obj); } // No space available, we have to rebuild free list or expand if (_allocate_before_rebuild == 0) { rebuild_free_list(); // updates _allocate_before_rebuild counter } else { // Append new block Thread* thread = Thread::current(); Handle obj_handle(thread, obj); // This can block, so we need to preserve obj accross call. _last->_next = JNIHandleBlock::allocate_block(thread); _last = _last->_next; _allocate_before_rebuild--; obj = obj_handle(); } return allocate_handle(obj); // retry }
/* * Make sure there is room for LEN more characters in BUF, in addition to the * null terminator and what's already in there. Return true on success. On * failure, set the error flag and return false. */ static int ensure_space(struct k5buf *buf, size_t len) { size_t new_space; char *new_data; if (buf->buftype == K5BUF_ERROR) return 0; if (buf->space - 1 - buf->len >= len) /* Enough room already. */ return 1; if (buf->buftype == K5BUF_FIXED) /* Can't resize a fixed buffer. */ goto error_exit; assert(buf->buftype == K5BUF_DYNAMIC || buf->buftype == K5BUF_DYNAMIC_ZAP); new_space = buf->space * 2; while (new_space - buf->len - 1 < len) { if (new_space > SIZE_MAX / 2) goto error_exit; new_space *= 2; } if (buf->buftype == K5BUF_DYNAMIC_ZAP) { /* realloc() could leave behind a partial copy of sensitive data. */ new_data = malloc(new_space); if (new_data == NULL) goto error_exit; memcpy(new_data, buf->data, buf->len); new_data[buf->len] = '\0'; zap(buf->data, buf->len); free(buf->data); } else { new_data = realloc(buf->data, new_space); if (new_data == NULL) goto error_exit; } buf->data = new_data; buf->space = new_space; return 1; error_exit: if (buf->buftype == K5BUF_DYNAMIC_ZAP) zap(buf->data, buf->len); if (buf->buftype == K5BUF_DYNAMIC_ZAP || buf->buftype == K5BUF_DYNAMIC) free(buf->data); set_error(buf); return 0; }
int XXp3(char *arg) { int result; printf("XXp3(): started, pid = %d, calling zap on pid 5\n", getpid()); result = zap(5); printf("XXp3(): after call to zap, result of zap = %d\n", result); return 0; } /* XXp3 */
void SiteArray::deinit() { if( size()==0 ) return; zap(); // zap the DynArrayB untapped_raw_count = 0; }
//--------- Begin of function SpyArray::deinit ----------// // void SpyArray::deinit() { if( size()==0 ) return; //-------- zap the array -----------// zap(); }
void BEQBaseUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int channel) throw() { int numSamplesToProcess = uGenOutput.getBlockSize(); float* outputSamples = uGenOutput.getSampleData(); float* inputSamples = inputs[Input].processBlock(shouldDelete, blockID, channel); float* freqSamples = inputs[Freq].processBlock(shouldDelete, blockID, channel); float* controlSamples = inputs[Control].processBlock(shouldDelete, blockID, channel); float* gainSamples = inputs[Gain].processBlock(shouldDelete, blockID, channel); float newFreq = *freqSamples; float newControl = *controlSamples; float newGain = *gainSamples; float y0; if((currentFreq != newFreq) || (currentControl != newControl) || (currentGain != newGain)) { while(numSamplesToProcess--) { calculateCoeffs(*freqSamples++, *controlSamples++, *gainSamples++); y0 = *inputSamples++ + b1 * y1 + b2 * y2; *outputSamples++ = (float)(a0 * y0 + a1 * y1 + a2 * y2); y2 = y1; y1 = y0; } currentFreq = *(freqSamples-1); currentControl = *(controlSamples-1); currentGain = *(gainSamples-1); } else { while(numSamplesToProcess--) { y0 = *inputSamples++ + b1 * y1 + b2 * y2; *outputSamples++ = a0 * y0 + a1 * y1 + a2 * y2; y2 = y1; y1 = y0; } } y1 = zap(y1); y2 = zap(y2); }
krb5_error_code KRB5_CALLCONV krb5_k_decrypt(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *ivec, const krb5_enc_data *input, krb5_data *output) { const struct krb5_keytypes *ktp; krb5_crypto_iov iov[4]; krb5_error_code ret; unsigned int header_len, trailer_len, plain_len; char *scratch = NULL; ktp = find_enctype(key->keyblock.enctype); if (ktp == NULL) return KRB5_BAD_ENCTYPE; if (input->enctype != ENCTYPE_UNKNOWN && ktp->etype != input->enctype) return KRB5_BAD_ENCTYPE; /* Verify the input and output lengths. */ header_len = ktp->crypto_length(ktp, KRB5_CRYPTO_TYPE_HEADER); trailer_len = ktp->crypto_length(ktp, KRB5_CRYPTO_TYPE_TRAILER); if (input->ciphertext.length < header_len + trailer_len) return KRB5_BAD_MSIZE; plain_len = input->ciphertext.length - header_len - trailer_len; if (output->length < plain_len) return KRB5_BAD_MSIZE; scratch = k5alloc(header_len + trailer_len, &ret); if (scratch == NULL) return ret; iov[0].flags = KRB5_CRYPTO_TYPE_HEADER; iov[0].data = make_data(scratch, header_len); memcpy(iov[0].data.data, input->ciphertext.data, header_len); iov[1].flags = KRB5_CRYPTO_TYPE_DATA; iov[1].data = make_data(output->data, plain_len); memcpy(iov[1].data.data, input->ciphertext.data + header_len, plain_len); /* Use empty padding since tokens don't indicate the padding length. */ iov[2].flags = KRB5_CRYPTO_TYPE_PADDING; iov[2].data = empty_data(); iov[3].flags = KRB5_CRYPTO_TYPE_TRAILER; iov[3].data = make_data(scratch + header_len, trailer_len); memcpy(iov[3].data.data, input->ciphertext.data + header_len + plain_len, trailer_len); ret = ktp->decrypt(ktp, key, usage, ivec, iov, 4); if (ret != 0) zap(output->data, plain_len); else output->length = plain_len; zapfree(scratch, header_len + trailer_len); return ret; }
void add_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels, ptrdiff_t line_size) { int h = 8; /* Keep this function a leaf function by generating the constants manually (mainly for the hack value ;-). */ uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */ uint64_t signmask = zap(-1, 0x33); signmask ^= signmask >> 1; /* 0x8000800080008000 */ do { uint64_t shorts0, pix0, signs0; uint64_t shorts1, pix1, signs1; shorts0 = ldq(block); shorts1 = ldq(block + 4); pix0 = unpkbw(ldl(pixels)); /* Signed subword add (MMX paddw). */ signs0 = shorts0 & signmask; shorts0 &= ~signmask; shorts0 += pix0; shorts0 ^= signs0; /* Clamp. */ shorts0 = maxsw4(shorts0, 0); shorts0 = minsw4(shorts0, clampmask); /* Next 4. */ pix1 = unpkbw(ldl(pixels + 4)); signs1 = shorts1 & signmask; shorts1 &= ~signmask; shorts1 += pix1; shorts1 ^= signs1; shorts1 = maxsw4(shorts1, 0); shorts1 = minsw4(shorts1, clampmask); stl(pkwb(shorts0), pixels); stl(pkwb(shorts1), pixels + 4); pixels += line_size; block += 8; } while (--h); }
int main() { { D a[10]; D x,y,z; test(); zap(); } if( dcount != 10+1+1+1+10 ) fail(__LINE__); _PASS; }
//-------------------------------------------------------------------------- // // Assignmenet Operator // //-------------------------------------------------------------------------- RegexPattern &RegexPattern::operator = (const RegexPattern &other) { if (this == &other) { // Source and destination are the same. Don't do anything. return *this; } // Clean out any previous contents of object being assigned to. zap(); // Give target object a default initialization init(); // Copy simple fields fPattern = other.fPattern; fFlags = other.fFlags; fLiteralText = other.fLiteralText; fDeferredStatus = other.fDeferredStatus; fMinMatchLen = other.fMinMatchLen; fMaxCaptureDigits = other.fMaxCaptureDigits; fStaticSets = other.fStaticSets; fStartType = other.fStartType; fInitialStringIdx = other.fInitialStringIdx; fInitialStringLen = other.fInitialStringLen; *fInitialChars = *other.fInitialChars; *fInitialChars8 = *other.fInitialChars8; fInitialChar = other.fInitialChar; // Copy the pattern. It's just values, nothing deep to copy. fCompiledPat->assign(*other.fCompiledPat, fDeferredStatus); fGroupMap->assign(*other.fGroupMap, fDeferredStatus); // Copy the Unicode Sets. // Could be made more efficient if the sets were reference counted and shared, // but I doubt that pattern copying will be particularly common. // Note: init() already added an empty element zero to fSets int32_t i; int32_t numSets = other.fSets->size(); fSets8 = new Regex8BitSet[numSets]; for (i=1; i<numSets; i++) { if (U_FAILURE(fDeferredStatus)) { return *this; } UnicodeSet *sourceSet = (UnicodeSet *)other.fSets->elementAt(i); UnicodeSet *newSet = new UnicodeSet(*sourceSet); if (newSet == NULL) { fDeferredStatus = U_MEMORY_ALLOCATION_ERROR; break; } fSets->addElement(newSet, fDeferredStatus); fSets8[i] = other.fSets8[i]; } return *this; }