应用笔记 6767

How ChipDNA Physically Unclonable Function Technology Protects Embedded Systems


摘要 : Hardware-based security provides robust protection against cyberattacks, and physically unclonable function (PUF) technology can further enhance that level of protection when used by chips that implement cryptographic functionality. This application note discusses a new PUF semiconductor solution, called ChipDNA technology, that utilizes the random analog characteristics of MOSFET transistors, the fundamental building block of CMOS ICs. At the chip level, the ChipDNA-based PUF solution is constructed from an array of analog circuit elements, featuring inherent randomness in I-V characteristics and sized according to the number of bits required to achieve the cryptographic requirements of the chip. When needed, the ChipDNA PUF is operated to derive a per-chip random, unique, and repeatable binary value that is only accessible by chip crypto blocks. Once it is no longer needed, the PUF-derived key value is instantaneously erased and does not exist in digital form. This ChipDNA PUF solution has demonstrated high reliability and appropriate crypto quality–both criteria that enable a PUF output to be used as a cryptographic key value. A similar version of this application note was originally published in the embedded world 2018 conference proceedings.

Introduction

Cryptography provides flexible and effective tools to counter a myriad of potential security threats that embedded electronic systems face. There are a variety of hardware and software approaches for implementing crypto solutions. It is generally understood that a hardware-based solution (i.e., a dedicated security IC) is the most effective formulation for the root of trust and the way to provide the countermeasures and protection that prevent numerous types of common attacks.

Valuable assets associated with embedded systems face relentless threats. For example, such systems encounter intrusions such as theft of intellectual property, introduction of malware to disrupt or destroy equipment, unauthorized access to sensitive communication, and tampering with data produced from IoT endpoints. Security ICs and the cryptographic solutions available can address these threats. However, the security ICs themselves can become the target of attack by an adversary attempting to circumvent or break the security.

Attacks on Security ICs

Assuming a security IC-based protection solution, there are two general categories of attack scenarios: non-invasive[1] and invasive.

Non-invasive attacks consist of operational measurements, sometimes combined with other externally applied stimuli, in an effort to obtain cryptographic keys or other sensitive data. Examples of such efforts include differential or simple power/electromagnetic analysis (DPA/SPA/DEMA/SEMA) or the inducing of fault states through voltage glitching, extreme thermal conditions, or laser and timing attacks. While the non-invasive attack threats are technically complex to address, there are established circuits and algorithmic countermeasures that are proven effective in protecting the security IC and sensitive stored data from being compromised.

Invasive attacks on a security IC consist of direct die-level circuit probing, modification, deprocessing, and reverse engineering, again with the objective of compromising the solution by obtaining keys, disabling functionality, or completely reverse engineering the design to a netlist for reproduction. The skill set and required tools are more complex than in the non-invasive scenarios, but they do exist and are commonly used to attack the security ICs that protect high-value assets. For example, Figure 1 and Figure 2 are examples of the output from tools that can be used with an invasive attack to first image a portion of an IC and then extract the netlist and schematics from the imaging. An attacker would repeat this process for the entire IC with the ultimate goal of gaining some insight to launch a sub-circuit attack or producing a database to replicate the IC

Imaged security IC area for schematic/netlist extraction Figure 1. Imaged security IC area for schematic/netlist extraction.

Schematic output from a tool that imaged the area Figure 2. Schematic output from a tool that imaged the area.

Like the non-invasive situation, there are circuit solutions available to combat invasive attacks. One example consists of top-level die shields that are actively monitored for a tamper event and combined with detection circuitry that takes defensive counteraction. However, the skills and equipment of attackers employing invasive techniques quickly evolve and have historically been a challenge to decisively defeat.

How PUF Technology Counters Invasive Attacks

Physically unclonable function (PUF) technology has emerged to provide strong protection against invasive threats[2]. PUF is derived from the complex and variable physical/electrical properties of ICs. Because PUF depends on random physical factors (unpredictable and uncontrollable) that exist natively and/or are incidentally introduced during a manufacturing process, it is virtually impossible to duplicate or clone. PUF technology natively generates a digital fingerprint for its associated security IC, which can be utilized as a unique key/secret to support cryptographic algorithms and services including encryption/decryption, authentication, and digital signature.

A PUF implementation from Maxim Integrated, known as ChipDNA technology, operates on the naturally occurring random variation and mismatch of the analog characteristics of fundamental semiconductor MOSFET devices. This randomness originates from factors such as oxide variation, device-to-device mismatch in threshold voltage, and interconnect impedances. Similarly, the wafer manufacturing process introduces randomness through imperfect or non-uniform deposition and etching steps. Paradoxically, semiconductor device parameter variation is normally a challenge that IC designers face during development and is the fundamental basis that is exploited for Maxim’s PUF design.

Figure 3 is a simplified block diagram of the Maxim‘s ChipDNA PUF architecture with an example key size of 128 bits. Shown within the PUF core block is a 16x16 array of 256 PUF elements, each of which is an analog structure. Through factory conditioning, these 256 elements are combined into 128 pairs. When comparing structure to structure, random I/V characteristics exist due to the previously described parameters and are utilized to generate binary 1/0 values through a precision circuit-level comparison of each element within a pair. For example, elements {2,1} and {14,16} could constitute a pair, and the I/V characteristics of each are compared to derive a bit value. This is repeated with each of the 128 pairs to produce a 128-bit PUF key output for the example key size. For larger key size requirements, the number of ChipDNA PUF elements is simply scaled.

Block diagram of Maxim Integrated’s PUF architecture. Figure 3. Block diagram of Maxim Integrated’s ChipDNA PUF architecture.

For invasive attacks, any probing or attempted analog measurement of a ChipDNA PUF element causes the sensitive analog electrical characteristic to change due to factors including capacitive/inductive/resistive loading. This is why it is impossible to extract any key data through invasive measurements. Also, because of the statistical nature of imperfect manufacturing techniques, there is no known method to discern any key information from inspection methods. Similarly, even knowledge of the ChipDNA PUF element paring does not reveal any information about the key value that can be ultimately derived from the analog characteristics of the PUF element structures. Finally, the PUF key value only exists digitally when a cryptographic operation is performed; thereafter, it is instantaneously erased. These ChipDNA PUF attributes together result in a solution that is highly immune to invasive attacks.

PUF Reliability and Cryptographic Quality

From a cryptographic perspective, reliability and randomness are critical characteristics that a PUF solution must exhibit. For use as a cryptographic key, or root thereof, the PUF output must have 100% reliability, meaning PUF-derived key bit values must be repeatable over time and all operating conditions. For semiconductor devices, this evaluation is performed using JEDEC-defined, industry-proven methods of reliability study. This includes selecting and subjecting a statistically significant sample set of devices to environmental and operational stress conditions that enable evaluation of lifetime reliability performance. These stresses include high-temperature operating life (HTOL), temperature cycling, packaging and solder reflow influences, voltage and temperature drift, and highly accelerated temperature/humidity stress testing (HAST). Performing a reliability qualification study using these proven methods results in a statistical assessment of how a design performs over the life of its use in a system. For example, consider that a system end product has a design life of 10 years and operates within -40°C to +85°C environments with power sources that can fluctuate by ±10%.

Equally critical with a PUF solution is the requirement for high-performance cryptographic quality, with a critcal property being randomness. Low-quality randomness can create a cryptographic attack vulnerability through predictability weakness. Statistical test suites, including the NIST SP 800-22, provide an industry-proven means to measure the randomness of the PUF output. Evaluation against the test suite provides several metrics, which determine whether the PUF output is consistent with a random sequence. To be statistically significant, these tools require large data sets for the analysis (e.g., 20-kbit sequences). Therefore, the output from a large set of PUF instances is required and used for the assessment.

Reliability Studies on ChipDNA

A lifetime reliability analysis of Maxim’s ChipDNA PUF yielded results that demonstrated its capabilities. Fundamentally, the reliability study produced data to understand the PUF elements, such as the shift from aging, temperature/voltage drift, IC packaging, and PCB assembly. Relative to the time-zero characteristics of two PUF paired elements, the paired elements after the reliability study are shown to consume approximately 7% of the total margin available to maintain the stability of the output binary value. The final output from the analysis is a ChipDNA PUF key error rate (KER) of ≤ 5ppb, where KER is defined as the probability that 1 bit within the total key size produced by the PUF (e.g., 256 bits) can flip over the life of the product.

A randomness assessment of the ChipDNA PUF relied on performance to the NIST standard SP 800-22 monobit, poker, runs test, and long run test. These test suites evaluate whether output data is consistent with a random sequence. Assessment results for each of the four tests validate excellent performance with respect to randomness.

To evaluate the immunity to invasive attacks and reverse engineering, the Maxim ChipDNA PUF solution was evaluated by a leading US-based company[3] that specializes in die level security assessments and IC reverse-engineering expertise. In the given assessment timeframe, the ChipDNA solution was not compromised, and there was a qualitative conclusion that the solution is “highly effective and resistant against physical Reverse Engineering attacks.”

ChipDNA Technology Use Cases

There are numerous ways ChipDNA PUF technology can be used for cryptographic operations within security ICs, some examples:.

In Figure 4, to secure all stored data on a security IC, the ChipDNA PUF-derived key is used to encrypt/decrypt data as needed using an algorithm such as AES. If an invasive attack gains access to any nonvolatile memory (NVM) data, that data is useless because it is encrypted and the attacker is not able to obtain the PUF-based decryption key. In this example the encryption/decryption of data is done exclusively on-chip as needed. PUF key encrypted data is not transmitted from the IC.

Encrypting IC NVM with the PUF secret key. Figure 4. Encrypting IC NVM with the PUF secret key.

Figure 5 shows the use of ChipDNA PUF as the unique private key for ECDSA signing operations. For this case the device would compute its own corresponding public key from the PUF private key and a certificate would be installed in NVM by a certificate authority prior to end-use deployment.

  无代理商订购价 请申请报价: 型号N "); $("#inventoryDetails").removeClass("col-sm-6"); $("#inventoryDetails").addClass("col-sm-12"); } else { var partNumber = encodeURIComponent(part_no); var htmlBulkOrder = "

" ; $("#buyQuantityDiv").html(htmlBulkOrder); } } } if( sampleJson.canQuote != true ) { $("#requestQuoteDiv").hide(); } if(sampleJson.leadTime == 0 && !(sampleJson.cf == "true" && sampleJson.carrierType == "Tape") ){ if($('#requestQuoteDiv').css('display') != "block") { $('#forLeadtime').removeClass('hidden'); } //$('#quantity5000').show(); } if(maxInventory == 0) { $("#stdleadTime").html('无库存交货期'); } if(params == 'Quote'){ $('#rowDiv').addClass("hidden"); $("#quoteRow").removeClass("hidden"); $("#nonQuote").addClass("hidden"); } else { if(leadTime != "" && leadTime != "undefined" && (parseInt(leadTime) > 0 && parseInt(leadTime) < 98) || parseInt(leadTime) == 0 ){ }else { if(userType != "DISTRIBUTOR") { $('#rowDiv div:not("#inventoryDetails,#requestQuoteDiv, #requestQuoteDiv2")').hide(); if($(".requestQuoteFromBuyCart").css('display') == 'none'){ $("#contactSales").show(); } } } } $('#addToCartP').modal('show'); if (userType == "EMPLOYEE" ) { $(document).find('#qtytobuyText').hide(); $(document).find('#product-quantity').hide(); $(document).find('#addToCartButton').hide(); $(document).find('#employeeMsg').show(); } if(sampleJson.cf == "true" && sampleJson.carrierType == "Tape" && maxInventory == 0){ $("#priceBreak").remove(); $("#orderingquotetext").remove(); $("#quantity5000").remove(); $('#useExistingQuote').remove(); $('#borderid').remove(); $('#inventoryDetails').removeClass('col-sm-6'); $('#inventoryDetails').addClass('col-sm-12'); $('#inventoryDetails').css('padding-left', '55px'); $('#inventoryDetails').css('padding-right', '55px'); $("#sotPartswithnostock").html('非常抱歉,没有足够的库存支持您的需求。因为这种包装类型是由我们的测试人员以卷的形式提供,所以我们只有在有充足库存的情况下,才销售这种类型的产品。目前,只有当我们完成最终测试后还有多余库存的情况下,我们才会在数量小于整卷的情况下,销售该产品。如果您想订购此产品,请将您的订单更改为带和卷的部件号(通常以+T或+T&R结尾),或者与您所在地区的分销合作伙伴联系以获得较小的数量'); } } } else { document.getElementById('buyParams').innerHTML = "Default"; digitalErrorFunction('系统出错,请联系客户支持'); bootbox.alert('系统出错,请联系客户支持'); } } }); var url = "/bin/checkQuoteAvailabilty?partNumber=" + encodeURIComponent(part_no) $.ajax({ url: url, dataType: "json", type: 'POST', async: false, xhrFields: { withCredentials: true }, success: function(data) { result = data; if(result != ""){ if(result.quoteList.quotes.quoteAvailable){ var quoteAvailable = result.quoteList.quotes.quoteAvailable; if(quoteAvailable == "true"){ $("#ortext").removeClass("hidden"); $('#useExistingQuote').show(); } } } } }); if (CQ_Analytics.PersonalInfoStoreMgr.getProperty("isLoggedIn") == "") { $.cookie("redirect","widget"); $.cookie("buy",buy); $.cookie("part_no",encodeURIComponent(part_no)); $.cookie("sampQty",sampQty); if(params == "ProductOrderTab"){ $.cookie("orderTab","true"); } } } else if (buy == "sample" && (CQ_Analytics.PersonalInfoStoreMgr.getProperty("isLoggedIn", true) || CQ_Analytics.PersonalInfoStoreMgr.getProperty("isLoggedIn", true) == "true")) { if(userType == "DISTRIBUTOR" || userType == "EMPLOYEE" ){ window.location.href = "https://shop.maximintegrated.com/backoffice/general/index.php?action=DISTRIBUTOR"; return false; } var userId = CQ_Analytics.ProfileDataMgr.getProperty("email"); var isSampleOrderAllowed = "true"; var sampleMessage = ""; var data = "userId="+userId; $.ajax({ type: "post", url: '/bin/validateSampleOrder', async: false, data: data, success: function(msg) { if(msg.error == "genericerrorText"){ digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); } else if(msg.status == false){ if(msg.message.match("^Your session expired")){ bootbox.confirm('登录超时,请重新登录。', function(result) { var authorizableId = CQ_Analytics.PersonalInfoStoreMgr.getProperty("authorizableId"); CQ.shared.Util.load("\x2Fbin\x2FLogoutServlet\x3Flanguage\x3Den"+"&authorizableId="+authorizableId); window.location="/cn/mymaxim/login.html"; }); } else { digitalErrorFunction(msg.message); bootbox.alert(msg.message); } }else{ isSampleOrderAllowed = msg.output.validateEmailDomain.isOrderAllowed; sampleMessage = msg.output.validateEmailDomain.message; var itemCount = msg.output.validateEmailDomain.itemCount; var orderCount = msg.output.validateEmailDomain.orderCount; if(localStorage.getItem(part_no) == 1) { mycart_widget("sample", function(status){ if(status && typeof _satellite != "undefined") _satellite.track("cart: add"); }); return false; } else { sampleAddToCart(isSampleOrderAllowed, sampQty, part_no, sampleMessage,itemCount,orderCount); } } } }); } else { $.cookie("redirect","widget"); $.cookie("buy",buy); $.cookie("part_no",encodeURIComponent(part_no)); $.cookie("sampQty",sampQty); if(params == "ProductOrderTab"){ $.cookie("orderTab","true"); } gigya.accounts.showScreenSet(aem.login.params); } } } function redirect_rochester(part_no){ var url = 'https://api.rocelec.com/parts/MAX/1?callback=callback&q='+ part_no +'&key=Z3kk1y*'; $.ajax({ type: 'GET', url: url, async: false, jsonpCallback: 'callback', contentType: "application/json", dataType: 'jsonp', success: function(json) { if(json.parts[0] != undefined){ if('permalink' in json.parts[0]){ window.open(json.parts[0].permalink,'_blank'); } else{ digitalErrorFunction('
Rochester暂无该器件库存,您可以 联系 对方进行采购。如果无法订购,请 联系我们的技术应用工程师 ,他们会帮您寻找可替代型号。
'); bootbox.alert('
Rochester暂无该器件库存,您可以 联系 对方进行采购。如果无法订购,请 联系我们的技术应用工程师 ,他们会帮您寻找可替代型号。
'); } } else{ if(typeof _satellite != "undefined"){ _satellite.track("rochester-popup"); } bootbox.alert('
Rochester暂无该器件库存,您可以 联系 对方进行采购。如果无法订购,请 联系我们的技术应用工程师 ,他们会帮您寻找可替代型号。
'); } }, error: function(e) { console.log(e.message); digitalErrorFunction(e.message); } }); } function getDistrbutorInventoryData(partNumber) { if(typeof partNumber != "undefined" && partNumber != "") { var distributors = {}; var distributor_template = Handlebars.compile($("#distributorData").html()); var data = "query="+encodeURIComponent(partNumber); $.ajax({ type: "post", url: '/bin/distributorInventoryComponent', async: true, data: data, success: function(data) { if(data.error == "genericerrorText"){ digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); } else if(data != null || data != ""){ $('#distributor-loading-image').hide(); if(data != "") { var dataJSON = JSON.parse(data); dataJSON['code']=partNumber; $('#distributor-modal').html(distributor_template(dataJSON)); } } } }); } } function add_to_cart(part_no, buy, params, sampQty,quantity) { var userType = encodeURI(CQ_Analytics.PersonalInfoStoreMgr.getProperty("userType")); if(userType == "") { userType="anonymous"; } var userId = CQ_Analytics.ProfileDataMgr.getProperty("email"); if(params == 'Quote'){ $("#addToCartP").attr('data-quote-id', sampQty.quoteId); $("#addToCartP").attr('data-quote-item-number', sampQty.quoteItemNumber); } if (buy == "part") { var message = ""; var data = "userId="+userId; var isOrderAllowed="true"; $.ajax({ type: "post", url: '/bin/validateRevenueOrder', async: false, data: data, success: function(msg) { if(msg.error == "genericerrorText"){ digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); } else{ isOrderAllowed = msg.output.validateEmailDomain.isOrderAllowed; message = msg.output.validateEmailDomain.message; } } }); if(isOrderAllowed == "true") { var result; var small_template = Handlebars.compile($("#buyModalBody").html()); document.cookie="mySearchServlet="+window.location+";domain=.maximintegrated.com;path=/"; var servletName = "/bin/SFComponent"; var url = servletName+"?input=single&query=" + encodeURIComponent(part_no)+"&userType="+userType; $.ajax({ url: url, dataType: "json", type: 'POST', xhrFields: { withCredentials: true }, success: function(data) { result = data; if(result == "genericerrorText"){ document.cookie="mySearchServlet="+window.location+";domain=.maximintegrated.com;path=/"; digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); }else if (result != "") { if(result.errors != undefined && result.errors[0].message) { document.cookie="mySearchServlet="+window.location+";domain=.maximintegrated.com;path=/"; digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); }else { document.cookie="mySearchServlet="+window.location+";domain=.maximintegrated.com;path=/"; var sampleJson = result; var vol = sampleJson.volumePrices; sampleJson.userType = userType; var noPricingMsg = 0; minQty = sampleJson.min; mult = sampleJson.mult; if(vol != undefined && userType != "DISTRIBUTOR" ) { for (var i = 0; i < vol.length; i++) { var j = i + 1; var vol1 = ""; if (j <= vol.length) { if(vol[i].minQuantity < 1000) { stdPricingFlag = 1; if(j == vol.length) { vol1 = vol[i].minQuantity + "+"; } else { vol1 = vol[i].minQuantity + "-" + vol[i].maxQuantity; } } else if(vol[i].minQuantity == 1000) { vol1 = "1000+"; stdPricingFlag = 1; } else { if(i ==0 && vol[i].minQuantity > 1000) { //vol1 = "No standard pricing available"; noPricingMsg++; delete sampleJson.volumePrices[i].formattedValue; } else { delete sampleJson.volumePrices[i]; continue; } } } else if(j == vol.length && j == 1) { vol1 = vol[i].minQuantity + "-" + 24; stdPricingFlag = 1; } sampleJson.volumePrices[i].minQuantity = vol1; } } maxInventory = sampleJson.stock.atpInv; leadTime = sampleJson.leadTime; if (maxInventory == "" || maxInventory == undefined) { maxInventory = 0; } $('#addToCart').html(small_template(sampleJson)); if(userType != "DISTRIBUTOR") { call(quantity); } } } else { document.getElementById('buyParams').innerHTML = "Default"; digitalErrorFunction('系统出错,请联系客户支持'); bootbox.alert('系统出错,请联系客户支持'); } } }); } else { digitalErrorFunction('系统出错,请联系 客户支持 '); $('#revenuedomainerrordialog').modal('show'); } } else if (buy == "sample") { if(userType == "DISTRIBUTOR" || userType == "EMPLOYEE" ){ window.location.href = "https://shop.maximintegrated.com/backoffice/general/index.php?action=DISTRIBUTOR"; return false; } var isSampleOrderAllowed = "true"; var sampleMessage = ""; var data = "userId="+CQ_Analytics.ProfileDataMgr.getProperty("email"); $.ajax({ type: "post", url: '/bin/validateSampleOrder', async: false, data: data, success: function(msg) { if(msg.error == "genericerrorText"){ digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); } else if(msg.status == false){ if(msg.message.match("^Your session expired")){ bootbox.confirm('登录超时,请重新登录。', function(result) { var authorizableId = CQ_Analytics.PersonalInfoStoreMgr.getProperty("authorizableId"); CQ.shared.Util.load("\x2Fbin\x2FLogoutServlet\x3Flanguage\x3Den"+"&authorizableId="+authorizableId); window.location="/cn/mymaxim/login.html"; }); } else { digitalErrorFunction(msg.message); bootbox.alert(msg.message); } }else{ isSampleOrderAllowed = msg.output.validateEmailDomain.isOrderAllowed; sampleMessage = msg.output.validateEmailDomain.message; var itemCount = msg.output.validateEmailDomain.itemCount; var orderCount = msg.output.validateEmailDomain.orderCount; if(localStorage.getItem(part_no) == 1) { mycart_widget("sample", function(status){ if(status && typeof _satellite != "undefined") _satellite.track("cart: add"); }); return false; } else { sampleAddToCart(isSampleOrderAllowed, sampQty, part_no, sampleMessage,itemCount,orderCount); } } } }); } } function sampleAddToCart(isSampleOrderAllowed, sampQty, part_no, sampleMessage,itemCount,orderCount) { if(isSampleOrderAllowed == "true"){ if(typeof orderCount != 'undefined' && parseInt(orderCount) >= 1){ bootbox.alert("Maxim规定每个会员可申请的免费样品有数量限制。您的申请数量超过了最大限制。如果您认为此消息有误,请发送电子邮件至 samples-admin@maximintegrated.com 。"); return; } else if(typeof itemCount != 'undefined' && parseInt(itemCount) >= 4){ bootbox.alert("您的样品订单已经超过了最多四(4)行的限制。您可以通过访问我们的 订购页面并搜索产品型号,以购买其他需要的产品"); return; } else{ //var qty = document.getElementById('product-quantity').value; if(sampQty>=1 || userType == "DISTRIBUTOR" || userType == "EMPLOYEE"){ var qty = 1; //taking qty fixed as 5 for sample var data = "input=addtocart&qty=" + qty + "&part_no=" + encodeURIComponent(part_no) + "&CartType=sampleCart&sampleQty="+sampQty+"&usertype="+userType; $.ajax({ type: "post", url: '/bin/cartOperations', async:false, data: data, success: function(msg, textStatus, jqXHR) { if (textStatus == "success") { if(msg=="false"){ digitalErrorFunction('数量超过了最大值,请修改数量。'); bootbox.alert('数量超过了最大值,请修改数量。'); return false; }else if(msg.match("^You") || msg.match("^Product")){ bootbox.confirm('登录超时,请重新登录。', function(result) { var authorizableId = CQ_Analytics.PersonalInfoStoreMgr.getProperty("authorizableId"); CQ.shared.Util.load("\x2Fbin\x2FLogoutServlet\x3Flanguage\x3Den"+"&authorizableId="+authorizableId); window.location="/cn/mymaxim/login.html"; }); }else if(msg.match("^No orderable unit")){ digitalErrorFunction(msg); bootbox.alert(msg); }else{ localStorage.setItem(part_no, "1"); mycart_widget("sample", function(status){ if(status && typeof _satellite != "undefined") _satellite.track("cart: add"); }); } } else { digitalErrorFunction('系统出错,请联系客户支持'+ JSON.stringify(msg)); bootbox.alert('系统出错,请联系客户支持'+ JSON.stringify(msg)); } } }); }else{ digitalErrorFunction('没有足够的样品数量,最多可申请的样品数量为'+ sampQty); bootbox.alert('没有足够的样品数量,最多可申请的样品数量为'+ sampQty); } } } else { if(sampleMessage =='SAMPLEEMAILDENIAL'){ //bootbox.alert(sampleMessage); $('#sampleemaildenialerrordialog').modal('show'); } else{ $('#domainerrordialog').modal('show'); } //bootbox.alert(sampleMessage); } } $(document).on("click", ".useThisBuyQuote", function () { var quantity = ""; quantity = $('#product-quantityBuyQuote').val(); quantity = quantity.trim(); if(quantity.length == 0){ digitalErrorFunction('请输入数量'); bootbox.alert('请输入数量'); quantity.focus(); return false; } var part_no = $('#Pcode').val(); var quoteId= $(this).data("quote-id"); var quoteItemId = $(this).data("quote-item-id"); $.ajax({ type: "post", url: '/bin/cartOperations', data: "input=addtocart"eId="+quoteId+""eItemNumber="+quoteItemId+"&qty=" + quantity + "&part_no=" + encodeURIComponent(part_no), success: function(msg, textStatus, jqXHR) { if (textStatus == "success") { if(msg.match("^You") || msg.match("^Product")){ if(msg.match("^Your session expired")) { bootbox.confirm('登录超时,请重新登录。', function(result) { var authorizableId = CQ_Analytics.PersonalInfoStoreMgr.getProperty("authorizableId"); CQ.shared.Util.load("\x2Fbin\x2FLogoutServlet\x3Flanguage\x3Den"+"&authorizableId="+authorizableId); window.location="/cn/mymaxim/login.html"; }); } else { digitalErrorFunction(msg); bootbox.alert(msg); return false; } } else if (msg.match("^No Price found")){ //bootbox.alert(msg); digitalErrorFunction('您申请的该型号数量,需要申请报价。'); bootbox.alert('您申请的该型号数量,需要申请报价。'); return false; } else if(msg.match('您申请的该型号数量,需要申请报价。')){ digitalErrorFunction(msg); bootbox.alert(msg); return false; } else if(msg==""){ digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); return false; } else if(quoteId != "" && quoteId != undefined && ! msg.match("statusCode=success")) { digitalErrorFunction(msg); bootbox.alert(msg); return false } else { $('#useQuoteModal').modal('hide'); mycart_widget(); if ($("#buyParams").html() == "SavedLater") { //alert("Yes inside"); deleteSavedForLater(part_no); } } } else { digitalErrorFunction('系统出错,请联系客户支持'+ JSON.stringify(msg)); bootbox.alert('系统出错,请联系客户支持'+ JSON.stringify(msg)); } } }); }); function call(quantity) { var qty ="",quoteId,quoteItemNumber = ""; if(typeof quantity != "undefined" && quantity !="") { qty=quantity; } else { var value = $('#product-quantity1').val(); if(value != "undefined" && value != "") { qty = value; } else{ qty = document.getElementById('product-quantity').value; } } qty = qty.trim(); var orderInMult = $('#orderInMult').val(); var orderInMin = $('#orderInMin').val(); var inventoryVal = $('#stockAvaliability').val(); var stockAvaliability = $('#stockAvaliability').val(); var cfValue = $('#cfValue').val(); var carrierTypeValue = $('#carrierTypeValue').val(); quoteId=$("#addToCartP").attr('data-quote-id'); quoteItemNumber=$("#addToCartP").attr('data-quote-item-number'); if(quoteId == undefined){ quoteId =""; quoteItemNumber = ""; } if(quoteId != "" && quoteId != undefined){ } else { if(!(cfValue == 'true' && carrierTypeValue == 'Tape')){ if(parseInt(qty) > parseInt(inventoryVal)){ if(qty != "" && orderInMult != "" && orderInMin != "" ){ if(parseInt(qty) < parseInt(orderInMin)){ $('#product-quantity').val(orderInMin); $('#quantity-label').show(); return false; } else if(qty % orderInMult == 0){ $('#quantity-label').hide(); } else { var modvalue = parseInt(qty) % parseInt(orderInMult); var q4 = parseInt(orderInMult)-parseInt(modvalue); var nearestNum = parseInt(qty) + parseInt(q4); //var nearestNum = (Math.round(qty / orderInMult)+1) * orderInMult; $('#product-quantity').val(nearestNum); $('#quantity-label').show(); return false; } } } else if(parseInt(qty) <= parseInt(inventoryVal) && carrierTypeValue == 'Reel'){ if(qty != "" && orderInMult != "" && orderInMin != "" ){ if(parseInt(qty) < parseInt(orderInMin)){ $('#product-quantity').val(orderInMin); $('#quantity-label').show(); return false; } else if(qty % orderInMult == 0){ $('#quantity-label').hide(); } else { var modvalue = parseInt(qty) % parseInt(orderInMult); var q4 = parseInt(orderInMult)-parseInt(modvalue); var nearestNum = parseInt(qty) + parseInt(q4); //var nearestNum = (Math.round(qty / orderInMult)+1) * orderInMult; $('#product-quantity').val(nearestNum); $('#quantity-label').show(); return false; } } } } // Bulk SOT Check if(cfValue == 'true' && carrierTypeValue == 'Tape'){ if(parseInt(stockAvaliability) == 0){ digitalErrorFunction('非常抱歉,没有足够的库存支持您的需求。因为这种包装类型是由我们的测试人员以卷的形式提供,所以我们只有在有充足库存的情况下,才销售这种类型的产品。目前,只有当我们完成最终测试后还有多余库存的情况下,我们才会在数量小于整卷的情况下,销售该产品。如果您想订购此产品,请将您的订单更改为带和卷的部件号(通常以+T或+T&R结尾),或者与您所在地区的分销合作伙伴联系以获得较小的数量'); bootbox.alert('非常抱歉,没有足够的库存支持您的需求。因为这种包装类型是由我们的测试人员以卷的形式提供,所以我们只有在有充足库存的情况下,才销售这种类型的产品。目前,只有当我们完成最终测试后还有多余库存的情况下,我们才会在数量小于整卷的情况下,销售该产品。如果您想订购此产品,请将您的订单更改为带和卷的部件号(通常以+T或+T&R结尾),或者与您所在地区的分销合作伙伴联系以获得较小的数量'); return false; } } } var part_no = document.getElementById('Pcode').value; if(qty.length == 0){ digitalErrorFunction('请输入数量'); bootbox.alert('请输入数量'); qty.focus(); return false; } if (qty % 1 != 0) { digitalErrorFunction('请填正整数'); bootbox.alert('请填正整数'); return false; } var userId = CQ_Analytics.ProfileDataMgr.getProperty("email"); if(CQ_Analytics.PersonalInfoStoreMgr.getProperty("isLoggedIn", true) || CQ_Analytics.PersonalInfoStoreMgr.getProperty("isLoggedIn", true) == "true") { var userType = encodeURI(CQ_Analytics.PersonalInfoStoreMgr.getProperty("userType")); if(typeof quantity != "undefined") { $.removeCookie("redirect"); $.removeCookie("part_no"); $.removeCookie("sampQty"); $.removeCookie("quantity"); $.removeCookie("buy"); } var message = ""; var data = "userId="+userId; var isOrderAllowed="true"; $.ajax({ type: "post", url: '/bin/validateRevenueOrder', async: false, data: data, success: function(msg) { if(msg.error == "genericerrorText"){ digitalErrorFunction('系统出错,请联系 客户支持 '); bootbox.alert('系统出错,请联系 客户支持 '); } else{ isOrderAllowed = msg.output.validateEmailDomain.isOrderAllowed; message = msg.output.validateEmailDomain.message; } } }); if(isOrderAllowed == "true") { $.ajax({ type: "post", url: '/bin/cartOperations', data: "input=addtocart"eId="+quoteId+""eItemNumber="+quoteItemNumber+"&qty=" + qty + "&part_no=" + encodeURIComponent(part_no), success: function(msg, textStatus, jqXHR) { if (textStatus == "success") { if(msg.match("^You") || msg.match("^Product")){ if(msg.match("^Your session expired")) { bootbox.confirm('登录超时,请重新登录。', function(result) { var authorizableId = CQ_Analytics.PersonalInfoStoreMgr.getProperty("authorizableId"); CQ.shared.Util.load("\x2Fbin\x2FLogoutServlet\x3Flanguage\x3Den"+"&authorizableId="+authorizableId); //window.location="/cn/storefront.html"; window.location="/cn/mymaxim/login.html"; }); } else { digitalErrorFunction(msg); bootbox.alert(msg); return false; } } else if (msg.match("^No Price found")){ //bootbox.alert(msg); digitalErrorFunction('您申请的该型号数量,需要申请报价。'); bootbox.alert('您申请的该型号数量,需要申请报价。'); return false; }else if(msg.match('您申请的该型号数量,需要申请报价。')){ digitalErrorFunction(msg); bootbox.alert(msg); return false; }else if(msg.match("^zeroInventoryErrorMsg")){ digitalErrorFunction('非常抱歉,没有足够的库存支持您的需求。因为这种包装类型是由我们的测试人员以卷的形式提供,所以我们只有在有充足库存的情况下,才销售这种类型的产品。目前,只有当我们完成最终测试后还有多余库存的情况下,我们才会在数量小于整卷的情况下,销售该产品。如果您想订购此产品,请将您的订单更改为带和卷的部件号(通常以+T或+T&R结尾),或者与您所在地区的分销合作伙伴联系以获得较小的数量'); bootbox.alert('非常抱歉,没有足够的库存支持您的需求。因为这种包装类型是由我们的测试人员以卷的形式提供,所以我们只有在有充足库存的情况下,才销售这种类型的产品。目前,只有当我们完成最终测试后还有多余库存的情况下,我们才会在数量小于整卷的情况下,销售该产品。如果您想订购此产品,请将您的订单更改为带和卷的部件号(通常以+T或+T&R结尾),或者与您所在地区的分销合作伙伴联系以获得较小的数量'); }else if(msg==""){ digitalErrorFunction('System error occured. Contact customer support for assistance.'); bootbox.alert('System error occured. Contact customer support for assistance.'); return false; } else if(quoteId != "" && quoteId != undefined && ! msg.match("statusCode=success")) { digitalErrorFunction(msg); var msgMatch = msg.match("^Quote compliance not met for quote number (.[0-9]*) as compliance is (.[0-9]%)$"); if(msgMatch){ bootbox.alert('您输入的数量不适用询价编号'+ msgMatch[1] + ',合规数量要求达到' + msgMatch[2]); }else { bootbox.alert(msg); } return false } else if(msg.match('To order this part, you must order the entire inventory of')){ bootbox.alert(msg); return false; } else if(msg.match('We are sorry! Unfortunately, there is not enough excess inventory to support this bulk SOT part request')){ bootbox.alert(msg); return false; } else if(msg.match('A valid quote is required to purchase this part')){ bootbox.alert(msg); return false; }else { $('#addToCartP').modal('hide'); mycart_widget("", function(status){ if(status && typeof _satellite != "undefined") _satellite.track("cart: add"); if(msg.match("entryNumber=1") && typeof _satellite != "undefined"){ _satellite.track("cart: open"); } }); if(quoteId != null && quoteId != "" && quoteId != undefined && msg.match("statusCode=success")){ window.digitalQuoteData = { quoteID : quoteId, quoteQuantity : qty, partNo : encodeURIComponent(part_no) } if(typeof _satellite != "undefined"){ _satellite.track("use-quote"); } } if ($("#buyParams").html() == "SavedLater") { //alert("Yes inside"); deleteSavedForLater(part_no); } } } else { digitalErrorFunction('系统出错,请联系客户支持'+ JSON.stringify(msg)); bootbox.alert('系统出错,请联系客户支持'+ JSON.stringify(msg)); } } }); } else { digitalErrorFunction('系统出错,请联系 客户支持 '); $('#revenuedomainerrordialog').modal('show'); } }else{ $.cookie("quantity",qty); $("#addToCartP").modal("hide"); gigya.accounts.showScreenSet(aem.login.params); } } function redirectBulkOrder(partNumber,quantity){ var url="/cn/storefront/bulk-order.html"; if(typeof partNumber != "undefined" && partNumber != "") { url+="?partNumber="+partNumber; } if(typeof quantity != "undefined" && quantity != "") { url+="&quantity="+quantity; } window.location.href = url; } function redirectToModelN(){ window.open("https://maxim.modeln.com/", '_blank',"width=400,height=150").focus(); } $(document).on('click', '.quoteDetails', function() { $("#useQuoteModal .modal-body").html(""); var index = ""; var quoteNo = ""; var part = $(this).data("part-no"); if(part == "" || part == "undefined") { digitalErrorFunction('请输入购买型号'); bootbox.alert('请输入购买型号'); return false; } if(quoteNo != "" && quoteNo != "undefined") { getQuotesList(part, index, quoteNo); } else { getQuotesList(part, index, quoteNo); digitalErrorFunction('请输入有效的询价单号'); //bootbox.alert('请输入有效的询价单号'); //return false; } }); var useQuoteModalTemplate = $("#useQuoteModalBody").html(); function getQuotesList(part, index, quoteId) { var userType = CQ_Analytics.PersonalInfoStoreMgr.getProperty("userType"); var oldPart = $("#partHidden"+index).val(); //oldpart == part to handle unnecessary quotelists api calls for same part. if(part == "" || part == undefined || part.length < 5 || oldPart == part) { return false; } if(userType == "" || userType == undefined){ $("#modelBuyCartButton").trigger("click"); gigya.accounts.showScreenSet(aem.login.params); return false; } var queryString = "quoteId="+quoteId+"&pendingStatus=&summery=disti&quantity=&materialNumber="+encodeURIComponent(part); var materialNumber = part; var activeFlag = 0; $.ajax({ url:"/bin/QuoteMangementServlet", type: 'GET', data: queryString, success:function(data){ //alert(JSON.stringify(data)); var useQuoteTemplate = Handlebars.compile(useQuoteModalTemplate); var useQuoteJson = {quotesList : [], code : materialNumber, index : index}; if(data.status == false) { var useQuoteJson = {quotesList : [], code : materialNumber, index : index, errorMessage : data.error.errorList.errors.message }; $("#modelBuyCartButton").trigger("click"); $("#quoteLineFlag"+index).val("false"); $('#useQuoteModal').html(useQuoteTemplate(useQuoteJson)); $('#useQuoteModal').modal('show'); digitalErrorFunction(data.error.errorList.errors.message); return false; } else { var quoteListJson = data.quoteList.quotes.quote; } if($.type(data.quoteList.quotes.quote) != "array") { if($.type(quoteListJson.quote_items) != "array") { if(quoteListJson.quote_items.product.code == materialNumber) { var quoteId = quoteListJson.ecom_qt_id_h; var quantity = quoteListJson.quote_items.quantity; //var price = findPriceByQuantity(quoteListJson.quote_items.product.volumePrices, quoteListJson.quote_items.quantity); price = (quoteListJson.quote_items.requote_price * 1).toFixed(3); if(userType == "DISTRIBUTOR") { price = (quoteListJson.quote_items.adj_disti_cost * 1).toFixed(3); quoteId = quoteListJson.modelNQuoteNumber; } var total = price * quantity; total =total.toFixed(3); if(quoteListJson.quote_items.quoteItemStatus == "ACTIVE" && quantity != "" && quantity != "undefined"){ activeFlag = 1; useQuoteJson.quotesList.push({"totalCost":total, "quoteItemId" : quoteListJson.quote_items.code, "status" : quoteListJson.quote_items.quoteItemStatus, "quantity":quantity, "entryNumber":quoteListJson.quote_items.item_num,"quoteId": quoteId, "price": price, "orderCompilance": quoteListJson.quote_items.ordcompliance}); } } else { //return useQuoteJson; //break; } } else { for(var i =0; i